for loop break and continue
| From: | Rich Fox | Date: | Thu, 25 Sep 2003 15:42:40 +0000 |
| Subject: | for loop break and continue | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-163930@lists.php.net to get a copy of this message | ||
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