Re: for loop break and continue

From: Date: Thu, 25 Sep 2003 15:47:13 +0000
Subject: Re: for loop break and continue
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-163931@lists.php.net to get a copy of this message
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. | `------------------------------------------------------------'

« previous php.general (#163931) next »