note 94615 added to control-structures.alternative-syntax
| From: | kevinarcher15 at hotmail dot com | Date: | Sat, 14 Nov 2009 22:08:20 +0000 |
| Subject: | note 94615 added to control-structures.alternative-syntax | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-162906@lists.php.net to get a copy of this message | ||
Mixing alternative syntax with regular syntax within if statements will fail when a nested if
statement occurs right before the "else:". This happens because the "} else"
confuses the engine and flows with the nested if. Adding any line of code to separate the brace and
else will prevent the problem from occurring, but you should avoid mixing the syntax instead.
<?php
if(true):
if(true) {
// actions
}
else:
// actions
endif;
?>
----
Server IP: 69.147.83.197
Probable Submitter: 207.210.5.78
----
Manual Page -- http://www.php.net/manual/en/control-structures.alternative-syntax.php
Edit -- https://master.php.net/note/edit/94615
Del: integrated -- https://master.php.net/note/delete/94615/integrated
Del: useless -- https://master.php.net/note/delete/94615/useless
Del: bad code -- https://master.php.net/note/delete/94615/bad+code
Del: spam -- https://master.php.net/note/delete/94615/spam
Del: non-english -- https://master.php.net/note/delete/94615/non-english
Del: in docs -- https://master.php.net/note/delete/94615/in+docs
Del: other reasons-- https://master.php.net/note/delete/94615
Reject -- https://master.php.net/note/reject/94615
Search -- https://master.php.net/manage/user-notes.php