Re: [PHP] if syntax using multiple conditions

2004-09-15 Thread Brian Anderson
Thanks! And, *wow* yes I just did try php2asp. Pretty good translation, although a few things need adjusting, it seems to do a remarkable job. I'll definitely have to play with it some more. :) -Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/un

Re: [PHP] if syntax using multiple conditions

2004-09-13 Thread John Nichel
Brian Anderson wrote: What is the proper syndax in an if statement for containing multiple conditions? example: if ( condition1 && condition2 ) { dothis; } if ( condition1 && (condition2 || condition3) ) { dothis; } Both are valid. First example will validate if both condition1 and condi

Re: [PHP] if syntax using multiple conditions

2004-09-13 Thread Greg Donald
On Mon, 13 Sep 2004 11:32:00 -0500, Brian Anderson <[EMAIL PROTECTED]> wrote: > What is the proper syndax in an if statement for containing multiple conditions? > > example: > > if ( condition1 && condition2 ) { > > dothis; > } > > if ( condition1 && (condition2 || condition3) ) { > >

Re: [PHP] if syntax using multiple conditions

2004-09-13 Thread raditha dissanayake
Brian Anderson wrote: What is the proper syndax in an if statement for containing multiple conditions? both examples you have given are valid but their logic is slightly different. example: if ( condition1 && condition2 ) { dothis; } if ( condition1 && (condition2 || condition3) ) { doth

Re: [PHP] if syntax

2002-07-10 Thread Derick Rethans
Martin Clifford wrote: > There are no brackets necessary if you only have one line of code to be executed in >the case. For example: > > if($var == 1) > echo "Var equals 1"; > } else { > echo Var does not equal 1"; > } This will certianly give a parse error, your sample should be: if

Re: [PHP] if syntax

2002-07-10 Thread Chris Hewitt
Hmm. I should read a bit further myself! I did not know about the colon indicating that there can be many statements before "else" or "endif". I've learnt something as a result, thanks. I should do some more engaging brain before keyboard! Chris Chris Hewitt wrote: > --snip--

Re: [PHP] if syntax

2002-07-10 Thread Chris Hewitt
Alexander, The thing to do is to try it yourself. Yes its OK for single statements (I assume the colon after the "$condition):" is a typo. The first two examples in the manual (Chapter 11, if) show this syntax though not with "else". HTH Chris Alexander Ross wrote: > >if($something): > ...

Re: [PHP] if syntax

2002-07-10 Thread vins
OK... This is another easy question that everyone has an answer for. Here's mine :D the if statement has many ways of being formed. 1 line code: (Echo or exit command) if(empty($Variable)) exit; else echo "Variable exists Multiple line code: if(empty($Variable)) { header("Location:

Re: [PHP] if syntax

2002-07-10 Thread R'twick Niceorgaw
uly 10, 2002 7:28 AM Subject: Re: [PHP] if syntax > This will only work if you have a single line of code after the else and > if. At least that is my understanding of all languages :) > > J > > > > > > "Alexander Ross" <[EMAIL PROTECTED]> >

Re: [PHP] if syntax

2002-07-10 Thread Martin Clifford
There are no brackets necessary if you only have one line of code to be executed in the case. For example: if($var == 1) echo "Var equals 1"; } else { echo Var does not equal 1"; } But this is not valid: if($var == 1) echo "Var equals "; echo "1"; } else { } HTH Mar

Re: [PHP] if syntax

2002-07-10 Thread jepadilla
This will only work if you have a single line of code after the else and if. At least that is my understanding of all languages :) J "Alexander Ross" <[EMAIL PROTECTED]> 07/10/2002 08:25 AM To: [EMAIL PROTECTED] cc: Subject:[PHP] if syntax I know t