note 109050 added to control-structures.break

From: Date: Sat, 16 Jun 2012 12:32:21 +0000
Subject: note 109050 added to control-structures.break
Groups: php.notes 
Request: Send a blank email to php-notes+get-188640@lists.php.net to get a copy of this message
A break statement that is in the outer part of a program (e.g. not in a control loop) will end the script. This caught me out when I mistakenly had a break in an if statement i.e. <?php echo "hello"; if (true) break; echo " world"; ?> will only show "hello" ---- Server IP: 69.147.83.197 Probable Submitter: 80.229.160.82 ---- Manual Page -- http://www.php.net/manual/en/control-structures.break.php Edit -- https://master.php.net/note/edit/109050 Del: integrated -- https://master.php.net/note/delete/109050/integrated Del: useless -- https://master.php.net/note/delete/109050/useless Del: bad code -- https://master.php.net/note/delete/109050/bad+code Del: spam -- https://master.php.net/note/delete/109050/spam Del: non-english -- https://master.php.net/note/delete/109050/non-english Del: in docs -- https://master.php.net/note/delete/109050/in+docs Del: other reasons-- https://master.php.net/note/delete/109050 Reject -- https://master.php.net/note/reject/109050 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#188640) next »