Re: for loop break and continue
| From: | Rich Fox | Date: | Thu, 25 Sep 2003 16:04:36 +0000 |
| Subject: | Re: for loop break and continue | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-163937@lists.php.net to get a copy of this message | ||
DOH!
This is a new addition to PHP because it wasn't there before!
Thanks for the slap.
"Robert Cummings" <robert@interjinn.com> wrote in message
news:1064504833.2813.3.camel@blobule.suds...
> Take the sample code below, paste it to a PHP file, add a real
> conditional, execute script. Voila, you've taken the first step towards
> helping yourself.
>
> Cheers,
> Rob.
>
>
> On Thu, 2003-09-25 at 11:42, Rich Fox wrote:
> > Hi,
> > Is there an equivalent to the C++ 'break' command to stop execution of a
for
> > loop? I know I can use 'goto' but I don't want to unless I have to.
> >
> > for ($i=0; $i<$n; $i++)
> > if (some condition)
> > break;
> >
> > And, what about 'continue' which skips the rest of the code in the for
loop
> > and immediately goes on to the next iteration?
> >
> > Thanks,
> >
> > Rich
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> --
> .------------------------------------------------------------.
> | InterJinn Application Framework - http://www.interjinn.com |
> :------------------------------------------------------------:
> | An application and templating framework for PHP. Boasting |
> | a powerful, scalable system for accessing system services |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for |
> | creating re-usable components quickly and easily. |
> `------------------------------------------------------------'