note 107424 added to control-structures.elseif

From: Date: Wed, 08 Feb 2012 09:36:39 +0000
Subject: note 107424 added to control-structures.elseif
Groups: php.notes 
Request: Send a blank email to php-notes+get-185905@lists.php.net to get a copy of this message
As Vladimir Kornea stated, this does not work: <?php if($a): echo $a; if($b) { echo $b; } else: echo $c; endif; ?> But when you put a semicolon after the inner if, PHP knows that the following else belongs to the outer if. Like this: <?php if($a): echo $a; if($b) { echo $b; }; // <- closing semicolon else: echo $c; endif; ?> ---- Server IP: 69.147.83.197 Probable Submitter: 213.46.117.233 ---- Manual Page -- http://www.php.net/manual/en/control-structures.elseif.php Edit -- https://master.php.net/note/edit/107424 Del: integrated -- https://master.php.net/note/delete/107424/integrated Del: useless -- https://master.php.net/note/delete/107424/useless Del: bad code -- https://master.php.net/note/delete/107424/bad+code Del: spam -- https://master.php.net/note/delete/107424/spam Del: non-english -- https://master.php.net/note/delete/107424/non-english Del: in docs -- https://master.php.net/note/delete/107424/in+docs Del: other reasons-- https://master.php.net/note/delete/107424 Reject -- https://master.php.net/note/reject/107424 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#185905) next »