PHP continue

Description

continue causes PHP to skip the rest of the current loop iteration and go on to the next iteration.

Example

The following code uses the continue statement to start the next iteration.


<?php/*from  w w w.  ja  va2s.  c o m*/
        for ($i = 1; $i < 10; $i = $i + 1) {
                if ($i == 3) continue;
                if ($i == 7) break;
                print "Number $i\n";
        }
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Language Basic »




PHP Introduction
PHP Operators
PHP Statements
Variable
PHP Function Create
Exception
PHP Class Definition