note 15468 deleted from control-structures.alternative-syntax by irc-html
| From: | irc-html@php.net | Date: | Sat, 19 Jan 2002 19:20:49 +0000 |
| Subject: | note 15468 deleted from control-structures.alternative-syntax by irc-html | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-25238@lists.php.net to get a copy of this message | ||
The following code will fail:
if ( true ) :
___ echo "yes";
___ if ( ! false ) echo ", of course";
else :
___ echo "no";
endif;
Will fail with syntax error, cause the interpreter 'thinks', that the "else:"
belongs to the "if (!false)". Use {}-syntax instead or use consequently
___ if (!false) : echo ", of course!"; endif;
Avoid to mix "if :"-syntax with {}- or single-statement-syntax.
Comment: This bogus could be fixed, if it wouldn't be allowed to mix "if {}"- or
"if-single-statement" with "if :"-statements (makes sense in my eyes).