note 68904 added to control-structures.else

From: Date: Tue, 15 Aug 2006 14:30:57 +0000
Subject: note 68904 added to control-structures.else
Groups: php.notes 
Request: Send a blank email to php-notes+get-115938@lists.php.net to get a copy of this message
This generates a parser error: <? if ($a == 1): /* nested if */ if ($b == 2) echo '2'; else: /* other code */ endif; ?> The nested "if" binds the outer "else" and the colon then generates a parser error. As this "bug" is not going to be fixed (see http://bugs.php.net/bug.php?id=838), this could be an artful solution to this problem: <? if ($a == 1): /* nested if */ if ($b == 2) echo '2'; /* dummy expression */ ; else: /* other code */ endif; ?> ---- Server IP: 212.24.129.110 Probable Submitter: 195.113.23.156 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/control-structures.else.php Edit -- https://master.php.net/note/edit/68904 Del: integrated -- https://master.php.net/note/delete/68904/integrated Del: useless -- https://master.php.net/note/delete/68904/useless Del: bad code -- https://master.php.net/note/delete/68904/bad+code Del: spam -- https://master.php.net/note/delete/68904/spam Del: non-english -- https://master.php.net/note/delete/68904/non-english Del: in docs -- https://master.php.net/note/delete/68904/in+docs Del: other reasons-- https://master.php.net/note/delete/68904 Reject -- https://master.php.net/note/reject/68904 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#115938) next »