Break enhancement to allow multiple loop breaking
@nbenitez
Submitted by Nelson Benítez León Link to original bug (#634368)
Description
Hi, the break statement of the php language can have an optional numerical argument which states how many loops to break. I've used this in some php code and found it very useful because if not I would have to use the goto statement with labels.
The following example is extracted from http://us.php.net/manual/en/control-structures.break.php
while (++$i) {
switch ($i) {
case 5:
echo "At 5<br />\n";
break; /* Exit only the switch. */
case 10:
echo "At 10; quitting<br />\n";
break 2; /* Exit the switch and the while. */
default:
break;
}
}
Edited by Rico Tzschichholz