PHP continue statement

PHP continue statement and break statement are identical but the only difference is PHP continue statement just skip the current iteration and continue execute other iteration inside loop. We can use continue statement in PHP iteration statement such as for loop, while loop and do-while loop. 

We can define PHP continue statement by using if statement such as if(condition) continue;  If the condition is true then the continue statement is executed.  Now we consider an example to understand the PHP continue statement.

PHP continue statement example:

<?php

for($count=0; $count<=10; $count++)

{

if($count==5)

continue;

echo $count;

}
In this example after if condition we use continue statement. So this program not print 5 because for continue statement. The output look like this where 5 is missing
1234678910

Comments

Popular posts from this blog

How to construct a B+ tree with example

How to show only month and year fields in android Date-picker?

Visitor Counter Script Using PHP