PHP continue Statement

PHP continue is used for skip current loop iteration and continue execution at the beginning of the next iteration.

continue accepts an optional numeric argument. The default value is 1, continue used with all loops for, while, do-while, and foreach loop

Example - continue

for ($i = 0; $i < 5; ++$i) {
    if ($i == 2)
        continue;
    print "$i";
}
//output: 0 1 3 4

Example - continue 3

$i = 1;
while ($i <= 2) {
    echo "Outer loop ";
    while (1) {
        echo "Middle loop";
        while (1) {
            echo "Inner";
			$i++;
           continue 3;
        }
        echo "it will not display.";
    }
}
/*output:
Outer loop
Middle loop
Inner
Outer loop
Middle loop
Inner*/