Re: [PHP] Is this valid: IF:.. ELSE: ENDIF:
On Sunday 05 May 2002 04:20, Miguel Cruz wrote: > On Sat, 4 May 2002, David Jackson wrote: > > Greeting --- > > I was handed a broken form that contain: > > > > IF (cond): > > > > . > > > > ELSEIF: > > > > .. > > ENDIF: > > > > > > My Questions are: > > 1. Is this type of "IF:" code block valid in PHP4.x.x? > > I think it is, but I've never heard of anyone using it. One teensy thing; > the endif should be followed by a semicolon rather than a colon, as it > terminates the compound statement. That alternative syntax is good for when doing conditional HTML loops. For example, for me, the following looks odd and untidy: if (something) { ?> Hello Hello -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* millihelen, n.: The amount of beauty required to launch one ship. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Is this valid: IF:.. ELSE: ENDIF:
Alternative methods are listed here: http://www.php.net/manual/en/control-structures.alternative-syntax.php ---John Holmes... > -Original Message- > From: David Jackson [mailto:[EMAIL PROTECTED]] > Sent: Saturday, May 04, 2002 1:28 PM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] Is this valid: IF:.. ELSE: ENDIF: > > Miguel -- > Thanks for you reply, the if (ops) else is the only one > could find listed in the docs. and you right that's the > why "normal people do it", but this devoloper used to be a COBAL > programer which explain it. > > Thanks again, > David > > > > On Sat, 4 May 2002, David Jackson wrote: > >> Greeting --- > >> I was handed a broken form that contain: > >> > >> IF (cond): > >> > >> . > >> > >> ELSEIF: > >> > >> .. > >> ENDIF: > >> > >> > >> My Questions are: > >> 1. Is this type of "IF:" code block valid in PHP4.x.x? > > > > I think it is, but I've never heard of anyone using it. One teensy > > thing; the endif should be followed by a semicolon rather than a > > colon, as it terminates the compound statement. > > > > Of course, most normal people use: > > > > if (cond) {} > > elseif (cond) {} > > > > and 'endif' is then moot as the scope of the branch is terminated by > > the last closing brace. > > > > miguel > > > -- > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is this valid: IF:.. ELSE: ENDIF:
Miguel -- Thanks for you reply, the if (ops) else is the only one could find listed in the docs. and you right that's the why "normal people do it", but this devoloper used to be a COBAL programer which explain it. Thanks again, David > On Sat, 4 May 2002, David Jackson wrote: >> Greeting --- >> I was handed a broken form that contain: >> >> IF (cond): >> >> . >> >> ELSEIF: >> >> .. >> ENDIF: >> >> >> My Questions are: >> 1. Is this type of "IF:" code block valid in PHP4.x.x? > > I think it is, but I've never heard of anyone using it. One teensy > thing; the endif should be followed by a semicolon rather than a > colon, as it terminates the compound statement. > > Of course, most normal people use: > > if (cond) {} > elseif (cond) {} > > and 'endif' is then moot as the scope of the branch is terminated by > the last closing brace. > > miguel -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is this valid: IF:.. ELSE: ENDIF:
On Sat, 4 May 2002, David Jackson wrote: > Greeting --- > I was handed a broken form that contain: > > IF (cond): > > . > > ELSEIF: > > .. > ENDIF: > > > My Questions are: > 1. Is this type of "IF:" code block valid in PHP4.x.x? I think it is, but I've never heard of anyone using it. One teensy thing; the endif should be followed by a semicolon rather than a colon, as it terminates the compound statement. Of course, most normal people use: if (cond) {} elseif (cond) {} and 'endif' is then moot as the scope of the branch is terminated by the last closing brace. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php