|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-11-14 21:23 UTC] jani@php.net
[2009-11-23 21:11 UTC] svn@php.net
[2009-11-23 21:11 UTC] bjori@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 00:00:02 2025 UTC |
Description: ------------ PHP is confusing else as part of the nested if statement above it. When removing the colon and replacing it with a left brace { it says unexepected '{' expecting ':'... Placing any line of code below the nested if will stop the problem from occurring, even while(false) { } prevents it. So it makes sense why its happening, however based on the syntax and alternative syntax it looks acceptable and PHP even seems to have an idea that the else is part of the alternative syntax. Test on stable 5.3.0 and 5.3.1-dev (August 15 2009). Reproduce code: --------------- if(true): if(true) { echo 'exepected'; } else: echo 'not here'; endif; Expected result: ---------------- expected Actual result: -------------- PHP Parse error: syntax error, unexpected ':' in /home/archer/test.php on line 5