PHP: go back to the start of loop using a sort of 'break' ?

Posted by matthy on Stack Overflow See other posts from Stack Overflow or by matthy
Published on 2011-01-08T01:44:26Z Indexed on 2011/01/08 1:53 UTC
Read the original article Hit count: 552

Filed under:
|
|

Hi i have a loop and i was wondering if there was a command that you can jump back to the start of the loop and ignore the rest of the code in the loop

example:

for ($index = 0; $index < 10; $index++) 
{
    if ($index == 6)
        that command to go the start of the loop

    echo "$index, ";
}

should output

1,2,3,4,5,7,8,9 and skip the six

sort of same result as

for ($index = 0; $index < 10; $index++) 
{
    if ($index != 6)
        echo "$index, ";
}

is there a command for that?

thanks, matthy

© Stack Overflow or respective owner

Related posts about php

Related posts about loops