How can I break an outer loop with PHP?

Marty picture Marty · May 4, 2011 · Viewed 56.4k times · Source

I am looking to break an outer for/foreach loop in PHP.

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

What's the PHP equivalent?

Answer

lucian303 picture lucian303 · May 4, 2011

In the case of 2 nested loops:

break 2;

http://php.net/manual/en/control-structures.break.php