PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<breakswitch>
Last updated: Mon, 16 Jul 2012

continue

continue 在循环结构用用来跳过本次循环中剩余的代码并开始执行下一次循环。

注: 注意在 PHP 中 switch 语句被认为是作为 continue 目的的循环结构。

continue 接受一个可选的数字参数来决定跳过几重循环到循环结尾。

<?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";
}
?>




<breakswitch>
 Last updated: Mon, 16 Jul 2012
 
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://manual.phpv.net/
Last updated: Thu Jul 7 19:13:47 2005 CST