1.2.86. Break Outside Loop¶
It is not possible anymore to include a piece of code inside a loop that will then break.
<?php
// outside a loop : This won't compile
break 1;
foreach($array as $a) {
break 1; // Compile OK
break 2; // This won't compile, as this break is in one loop, and not 2
}
foreach($array as $a) {
foreach($array2 as $a2) {
break 2; // OK in PHP 5 and 7
}
}
?>
1.2.86.1. Specs¶
Short name |
Structures/BreakOutsideLoop |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
With PHP 7.0 and older |
Severity |
Major |
Time To Fix |
Slow (1 hour) |
Precision |
Very high |
Features |
break, loop |
Available in |