PHP Continue Statement

The continue statement in PHP is used to skip the current iteration of a loop and move on to the next iteration.

Syntax

continue;

Example of PHP Continue Statement

<?php
for ($i = 0; $i < 10; $i++) {
    if ($i == 5) {
        continue;
    }
    echo $i . "\n";
}
?>

Output:

0
1
2
3
4
6
7
8
9

Explanation: This example demonstrates the use of the continue statement in PHP. The current iteration is skipped when the value of $i is 5.