超越PHP PHP动态 | 经典文章 | CLASS | 相关下载 | 常见问题 | FORUM | WIKI | 在线手册
Site search:    
<breakswitch>
Last updated: Fri, 22 Jun 2007

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




add a note add a note User Contributed Notes
continue
CelloG at phpdoc dot org
02-May-2003 09:55
continue works for:

do
while
switch
for
foreach

<breakswitch>
 Last updated: Fri, 22 Jun 2007
view source | feedback | send page | sitemap | aboutus   
Copyright ® 2002-2003 PHPE.NET. All rights reserved
Last updated:2002-11-22