Is it possible to break from a switch and then continue in a loop?
For example:
$numbers= array(1,2,3,4,5,6,7,8,9,0);
$letters = array('a', 'b', 'c', 'd', 'e', 'f', 'g');
foreach($letters as $letter) {
foreach($numbers as $number) {
switch($letter) {
case 'd':
// So here I want to 'break;' out of the switch, 'break;' out of the
// $numbers loop, and then 'continue;' in the $letters loop.
break;
}
}
// Stuff that should be done if the 'letter' is not 'd'.
}
Can this be done, and what would the syntax be?
You want to use break n
break 2;
After clarification, looks like you want continue 2;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With