note 87723 added to control-structures.alternative-syntax
| From: | claudedotpacheatgmaildotxxx at osu1 dot php dot net | Date: | Thu, 18 Dec 2008 10:37:01 +0000 |
| Subject: | note 87723 added to control-structures.alternative-syntax | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-148297@lists.php.net to get a copy of this message | ||
Beware that ambiguities arise in some occasions when you use a "if(...) {...}" construct
inside a "if(...): / else: / endif;" construct.
Once I wrote something like this:
<?php
if (foo):
lorem ipsum;
dolor sit amet;
if (bar) { quax; }
else:
lorem ipsum;
dolor sit amet;
endif;
?>
I've got an "unexpected ':'" error: Indeed, PHP had associated the
"else" to the "if(bar) { quax; }", and then didn't expect to find a colon
after the "else".
(At least, these sort of things do not yield bogus-but-runnable code.)
----
Server IP: 69.147.83.197
Probable Submitter: 83.176.40.192
----
Manual Page -- http://www.php.net/manual/en/control-structures.alternative-syntax.php
Edit -- https://master.php.net/note/edit/87723
Del: integrated -- https://master.php.net/note/delete/87723/integrated
Del: useless -- https://master.php.net/note/delete/87723/useless
Del: bad code -- https://master.php.net/note/delete/87723/bad+code
Del: spam -- https://master.php.net/note/delete/87723/spam
Del: non-english -- https://master.php.net/note/delete/87723/non-english
Del: in docs -- https://master.php.net/note/delete/87723/in+docs
Del: other reasons-- https://master.php.net/note/delete/87723
Reject -- https://master.php.net/note/reject/87723
Search -- https://master.php.net/manage/user-notes.php