Re: [PHP] Break or continue an outer loop from an inner loop?
- Date: Tue, 05 Dec 2017 19:45:43 +0000
- From: Ashley Sheridan <ash@xxxxxxxxxxxxxxxxxxxx>
- Subject: Re: [PHP] Break or continue an outer loop from an inner loop?
On 5 December 2017 19:33:15 GMT+00:00, Jeffry Killen <jekillen@xxxxxxxxxxx> wrote:
>I have read this early on in texts I have used but have never used it.
>Now I have a project that looks like it is appropriate.
>The code starts a loop and inside the loop for each iteration
>there is an inner loop.
>What I need to do is: depending on a conditional, I want to
>tell the outer loop to continue from the inner loop: I.E.
>stop the inner loop iteration and have the outer loop jump
>to its next iteration.
>I remember something about labels of some other symbol
>associated with each loop and can specify that symbol.
>But I don't remember the details.
>Can someone guide me with this, or point me to the
>applicable part of the manual?
>Thanks for time and attention
If you just want to stop the inner loop and continue the outer one, a simple break will do:
for($i=0; $i<10; $i++)
for($j=0; $j<10; $j++)
echo "$i, $j\n";
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php