★ wanayoo — archive 1999 http://php.net/manual/control-structures.continue.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to Control Structures
Quick Reference
Control Structures
English version of this pageGerman version of this pageJapanese version of this page
Italian version of this pageFrench version of this pageHungarian version of this page
Spanish version of this page
* if
* else
* elseif
* Alternative syntax for control structures
* while
* do..while
* for
* foreach
* break
* continue
* switch
* require
* include
* require_once
* include_once

  Thanks to:
 Chek.com
 easyDNS
 VA Linux Systems

  Related sites:
Apache
MySQL
PostgreSQL
Zend Tech.

  Community:
LinuxFund.org
OSDN
Manual: continue
View the source code for this pageSearch the site



Previous page
 break
 Updated
Fri, 15 Sep 2000
switch 
Next page


continue

continue is used within looping structures to skip the rest of the current loop iteration and continue execution at 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.


while (list ($key, $value) = each ($arr)) {
    if (!($key % 2)) { // skip odd members
        continue;
    }
    do_something_odd ($value);
}

$i = 0;
while ($i++ < 5) {
    echo "Outer<br>\n";
    while (1) {
        echo "  Middle<br>\n";
        while (1) {
            echo "  Inner<br>\n";
            continue 3;
        }
        echo "This never gets output.<br>\n";
    }
    echo "Neither does this.<br>\n";
}
     


User Contributed Notes: continue


dmacdo@moncourrier.com
04-Aug-2000 03:48
The break will get out of the loop, while the continue stay in the loop, it just gets to the next iteration, not doing the one it was suposed to. (as I understanded it...)


 About Notes


Previous page
 break
 Updated
Fri, 15 Sep 2000
switch 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.