note 117259 deleted from control-structures.break by cmb
| From: | cmb@php.net | Date: | Mon, 11 May 2015 12:01:18 +0000 |
| Subject: | note 117259 deleted from control-structures.break by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-202497@lists.php.net to get a copy of this message | ||
Note Submitter: subhadeep dot ghosh dot sg at gmail dot com
----
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;
?>