PHP » Control Structures » continue

Syntax:
continue [n]
n
Number of levels to skip.

Skips to the beginning of a control statement.

This statement provides a way to skip the execution of the rest of a block and restart at the beginning of a control block with a new iteration. If there are nested control structures, a number specifying the number of levels to skipped can be provided.

Examples

Code:
<?php

for ($i = 0; $i < 10; $i++) {
   if ($i % 2 == 0)
      continue;
   print "$i ";
}

?>
Output:
1 3 5 7 9
Explanation:

Continue is used in a for loop to only print something at every other iteration.

See Also: