"Lars Torben Wilson" <[EMAIL PROTECTED]> wrote in message 1012867253.2248.185.camel@ali">news:1012867253.2248.185.camel@ali... > On Mon, 2002-02-04 at 15:54, Erik Price wrote: > > Short and sweet: > > > > If I have an "if" statement inside a "switch" statement, how can I > > "break" out of both blocks that I am in? Will one "break" end > > everything? Or should I use one for each level deep that I am? > > > > > > Erik > > From the manual: > > break accepts an optional numeric argument which tells it how > many nested enclosing structures are to be broken out of > > You can find this at http://www.php.net/break (which will take you > to http://www.php.net/manual/en/control-structures.break.php). > > > Hope this helps, > > Torben
That being said, break only breaks out of looping constructs. A break placed within an if-block will break out of the loop around it. There isn't a direct way to break out of an if-block alone (if that's your intent), though this will work: do { if(condition) { ... ... ... break; } } while(0); -- Daniel Grace -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php