note 68902 added to control-structures.elseif

From: Date: Tue, 15 Aug 2006 14:02:27 +0000
Subject: note 68902 added to control-structures.elseif
Groups: php.notes 
Request: Send a blank email to php-notes+get-115936@lists.php.net to get a copy of this message
This example generates a parse error: <? if ($a==1): /* nested if */ if ($b==1) echo "2"; elseif ($a==3): /* other code */ endif; ?> The nested "if" binds to the outer "elseif" and the colon the generates an error: syntax error, unexpected ':'. According to http://bugs.php.net/bug.php?id=838 this "bug" is not going to be fixed. Beware. An "artful" sollution to this bug could look like this: <? if ($a==1): /* nested if */ if ($b==1) echo "2"; /* dummy expression */ ; elseif ($a==3): /* other code */ endif; ?> ---- Server IP: 147.32.160.17 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.elseif.php Edit -- https://master.php.net/note/edit/68902 Del: integrated -- https://master.php.net/note/delete/68902/integrated Del: useless -- https://master.php.net/note/delete/68902/useless Del: bad code -- https://master.php.net/note/delete/68902/bad+code Del: spam -- https://master.php.net/note/delete/68902/spam Del: non-english -- https://master.php.net/note/delete/68902/non-english Del: in docs -- https://master.php.net/note/delete/68902/in+docs Del: other reasons-- https://master.php.net/note/delete/68902 Reject -- https://master.php.net/note/reject/68902 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#115936) next »