PHP Continue Statement

The continue statement is used inside the loop. In continue statement if a specified condition occurs, then it skips the current iteration and execute to the next iterations of the loop. The basic syntax of Continue statement is as follows :
 continue;
Where the continue keyword skip the current iteration of the loop.

Now lets see an example of Continue statement :
<?php
  $x = 0;
  while($x < 10) {
    $x++;
    if($x == 6) {
      continue;
    }
    echo "$x<br/>";
  }
?>
Output :

1
2
3
4
5
7
8
9
10

As we can see in the above example when x is equal to 6, then the rest of the code will skipped and the loop will goes to next iteration.

Next Topic :