I have a nested loop like so:
while(1){
while($something){
break & continue;
}
// More stuff that I don't want to process in this situation
}
I want to break out of the 2nd while loop and continue the 1st loop from the start (without finishing the 1st loop). Is this possible without using variables?
You can continue 2;
in your inner loop to continue the outer loop from the beginning.
http://php.net/manual/en/control-structures.continue.php
continue accepts an optional numeric argument which tells it how many levels of enclosing loops it should skip to the end of. The default value is 1, thus skipping to the end of the current loop.
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