Click to See Complete Forum and Search --> : Continue statement


ssffcc
03-07-2006, 12:10 PM
hi, I am new to PHP
I read this code:

if ($value < $max) {
continue;

It didnt really make sense to me, can anyone plz help me to understand more about the "Continue" statement?

bokeh
03-07-2006, 12:26 PM
Have you looked at the manual? It's always a good place to start and the documents are pretty well written. Continue; (http://www.php.net/continue)

SpectreReturns
03-07-2006, 11:28 PM
Continue just skips the rest of the commands in an iteration, which is useful if you only want to process some elements of an array, but check them all.

ssffcc
03-08-2006, 11:42 AM
thanks very much all of you, I totally understood now, continue terminate the current loop and go for next round, wherease break simply terminate the entire block.
:)

john_de116
03-09-2006, 03:38 AM
You want to use the continue statement in for loop when you are using the break; statement.
For eg.,
for($i=0;$i<=count($res)-1;$i++)
{
if(($i%3)==0)
break;
else
continue;
}
continue; statement is working for this kind of statements....

NogDog
03-09-2006, 05:21 AM
You want to use the continue statement in for loop when you are using the break; statement.
For eg.,
for($i=0;$i<=count($res)-1;$i++)
{
if(($i%3)==0)
break;
else
continue;
}
continue; statement is working for this kind of statements....
Huh? :confused: