Toms Homepage
  Home    Downloads    Your Account    Forums  
  Create an account
Modules
· Home
· Games
· My Gallery
· PHP Manual
· PHP-Nuke HOWTO
· Web Links
· Your Account
 
Who's Online
Welcome, Anonymous
Nickname

Password

Security Code
Security Code
Type Security Code


(Register)

Membership:
Latest: EdwardPer
New Today: 475
New Yesterday: 487
Overall: 47914

People Online:
Visitors: 67
Members: 8
Total: 75

Online Now:
COM AlfonzoBe
 EleanorMc
COM JudyRoger
 Luciana22
COM LonMayes
NET SaraNJF
 MinervaRo
 JosephJON
 
continue

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.

Note: Note that in PHP the switch statement is considered a looping structure for the purposes of continue.

continue accepts an optional numeric argument which tells it how many levels of enclosing loops it should skip to the end of.

<?php
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
"&nbsp;&nbsp;Middle<br />\n";
        while (
1) {
            echo
"&nbsp;&nbsp;Inner<br />\n";
            continue
3;
        }
        echo
"This never gets output.<br />\n";
    }
    echo
"Neither does this.<br />\n";
}
?>


Omitting the semicolon after continue can lead to confusion. Here's an example of what you shouldn't do.

<?php
  
for ($i = 0; $i < 5; ++$i) {
      if (
$i == 2)
          continue
      print
"$i\n";
  }
?>

One can expect the result to be :

0
1
3
4

but this script will output :

2

because the return value of the print() call is int(1), and it will look like the optional numeric argument mentioned above.


All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest © 2004 by Tom Nitzschner.
Web site engine code is Copyright © 2003 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.062 Seconds

:: VereorLCARS phpbb2 style by Vereor :: PHP-Nuke theme by www.nukemods.com ::