如何使用 PHP 中断外部循环? [英] How can I break an outer loop with PHP?
本文介绍了如何使用 PHP 中断外部循环?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望打破 PHP 中的外部 for/foreach 循环.
I am looking to break an outer for/foreach loop in PHP.
这可以像这样在 ActionScript 中完成:
This can be done in ActionScript like so:
top : for each(var i:MovieClip in movieClipArray)
{
for each(var j:String in nameArray)
{
if(i.name == j) break top;
}
}
PHP 的等价物是什么?
What's the PHP equivalent?
推荐答案
在 2 个嵌套循环的情况下:
In the case of 2 nested loops:
break 2;
http://php.net/manual/en/control-structures.break.php
这篇关于如何使用 PHP 中断外部循环?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文