continuecontinue is used within looping structures to skip the rest of the current loop iteration and continue execution at the condition evaluation and then the beginning of the next iteration.
continue accepts an optional numeric argument which tells it how many levels of enclosing loops it should skip to the end of. The default value is 1, thus skipping to the end of the current loop.
<?php Omitting the semicolon after continue can lead to confusion. Here's an example of what you shouldn't do.
<?php One can expect the result to be: 0 1 3 4 but this script will output: 2 because the entire continue print "$i\n"; is evaluated as a single expression, and so print is called only when $i == 2 is true. (The return value of print is passed to continue as the numeric argument.)
|