Edit report at https://bugs.php.net/bug.php?id=65232&edit=1
ID: 65232 Updated by: a...@php.net Reported by: nayana at corp-gems dot com Summary: error if "else" begins with a new php block -Status: Open +Status: Not a bug Type: Bug Package: *General Issues Operating System: Any PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Please read about the syntax you trying to use here http://php.net/manual/en/control-structures.alternative-syntax.php . Previous Comments: ------------------------------------------------------------------------ [2013-07-10 10:35:25] me at rudi dot xxx Source: http://stackoverflow.com/questions/17567868/error-if-else-begins-with-a- new-php-block I don't see this as an issue, though. If anything it's a good safeguard against even worse PHP code. I would fully expect to read this that the first if block is completed, and that the second is treated as new code entirely. The only special context that should be retained between these open/close braces are those that hold an active meaning - for example the contents of an if block (anything within }). ------------------------------------------------------------------------ [2013-07-10 10:31:05] nayana at corp-gems dot com Description: ------------ There is a parse error occurring if the "else" condition is placed in a new block. Is this the intended behavior. I was unable to locate documentation that describes this behavior. <?php if (true) { ?> Foo <?php } ?> <?php else { ?> Bar <?php } ?> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=65232&edit=1