Articles in Basics Category

Continue Statement

Continue statement is used in loops to skip the current iteration and move to next iteration. Think that you have a game and you don’t show the score of fourth stage to the player and add it at the end as a surprise.

You can implement this scenario as below using an array, a For loop and a continue statement.

$stages = array(50, 110, 130, 71, 203);
$count = count($stages);

for ($i=0; $i<$count; $i++) {

	if ($i == 3) {

	echo 'Stage '.($i+1).' Score: '.$stages[$i].'<br />';


After running, above code segment will print following lines in your web browser.

Stage 1 Score: 50
Stage 2 Score: 110
Stage 3 Score: 130
Stage 5 Score: 203

If you were inside a Nested For loop (say two levels) and once the condition becomes true, if you need to move to the next iteration of outer for loop then you can pass number of levels to skip as below.


In Switch Case control structure, in the place of break statement, continue statement can be used but it’s bit uncommon.

Where to Head from Here...
Share with Your Peers...

We Value Your Feedback...

We love to hear what you think about this article. Please provide your opinion, suggestions and improvements using following form. Note that submitted feedback is not displayed but we will get back to you if it needs a reply.