On Mon, 2002-02-04 at 20:19, Daniel Grace wrote:
> "Lars Torben Wilson" <[EMAIL PROTECTED]> wrote in message

> >
> > 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:

Not true, as break works on switch() as well; switch() would be fairly
useless without it. :) You are correct that it does not consider an if()
block to be an enclosing loop, though. 


Torben

> do {
>     if(condition) {
>         ...
>         ...
>         ...
>         break;
>     }
> } while(0);
> 
> -- Daniel Grace

-- 
 Torben Wilson <[EMAIL PROTECTED]>
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to