Ok I have an outer and inner loop. If some condition is met in the inner loop, I want to break it and continue the outer loop from the beginning (roll it over to the next entry).
I have come up with the following method using break on the inner loop if the condition is met and continue on the outer loop immediately after the inner loop if the condition is met. It works fine, but I'm just wondering if there is something built into PHP to do this (I could not find anything).
Here is an example pseudo code incase that was too difficult to follow:
[php]//outer loop
foreach ($outer_array as $outer) {
// some other code here
.....
// inner loop
foreach ($inner_array as $inner) {
// some other code here
.....
// if conditions is true, break this loop
if ($condition == true) {
break;
}
}
// if condition is true, continue this loop
if ($condition == true) {
continue;
}
// some other code here
.....
}[/php]
This works I know, but am just wondering if there is an easier way to do it.