note 117259 added to control-structures.break

From: Date: Mon, 11 May 2015 09:59:34 +0000
Subject: note 117259 added to control-structures.break
Groups: php.notes 
Request: Send a blank email to php-notes+get-202495@lists.php.net to get a copy of this message
As of PHP 5.6, the break statement can only be used inside a loop. The break statement cannot be used in any non-iterative, that is non-loop statement. e.g. The following code when execute will show a Fatal Error: <?php $num = 600; if ($num % 10 == 0) { echo 'Multiple of 100'; if ($num > 500) break; echo 'Done'; } $result = $num / 10; echo $result; ?> ---- Server IP: 72.52.91.14 Probable Submitter: 115.111.230.10 ---- Manual Page -- http://php.net/manual/en/control-structures.break.php Edit -- https://master.php.net/note/edit/117259 Del: integrated -- https://master.php.net/note/delete/117259/integrated Del: useless -- https://master.php.net/note/delete/117259/useless Del: bad code -- https://master.php.net/note/delete/117259/bad+code Del: spam -- https://master.php.net/note/delete/117259/spam Del: non-english -- https://master.php.net/note/delete/117259/non-english Del: in docs -- https://master.php.net/note/delete/117259/in+docs Del: other reasons-- https://master.php.net/note/delete/117259 Reject -- https://master.php.net/note/reject/117259 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#202495) next »