PHP Break & Continue at the same time PHP Break & Continue at the same time php php

PHP Break & Continue at the same time


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.


Just use 'break' in inner loop. It will break out of the inner loop and the outer loop will continue.


After the inner while, can you not just use an if statement to execute the continue?

while(1){    while($something){        break;    }    if (!$something) {       continue;    }    // More stuff that I don't want to process in this situation}