您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

PHP函数continue在循环结构中的用法_PHP教程

2026/1/23 8:02:56发布15次查看
我们在实际的php函数continue与众不同之处在于接受一个可选的数字参数来决定跳过几重循环到循环结尾。
在php中,continue 在循环结构中用来跳过本次循环中剩余的代码并开始执行下一次循环。这一点和其他语言是一致的,不过,另有妙处:continue 接受一个可选的数字参数来决定跳过几重循环到循环结尾。
#php_continue.php   $i = 0;  $j = 0;  while ($i++ 3) {//level 3  echo outer  n;  while (1){//level 2  echo middle  n;  while (1){//level 1  echo inner  n;  continue 3;  }  echo thisnever gets output.  n;  }  echoneither does this.  n;  $j++;  //after runscontinue 3,it comes to the end of level 3  }  echo$j=$j;//output: $j=0 ?> 
以上这段代码,就是php函数continue的具体用法,希望对大家有所帮助。
http://www.bkjia.com/phpjc/446358.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/446358.htmltecharticle我们在实际的 php函数continue与众不同之处在于接受一个可选的数字参数来决定跳过几重循环到循环结尾。 在php中,continue 在循环结构中用来...
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product