Continue a for loop in PHP

Description

The following code shows how to continue a for loop.

Example


<?php/*  ww  w  .j av  a  2 s .c om*/
    $usernames = array("grace","doris","gary","nate","missing","tom");
    for ($x=0; $x < count($usernames); $x++) {
        if ($usernames[$x] == "missing") 
           continue;
        echo "Staff member: $usernames[$x] <br />";
    }
?>

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