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:
1234678910
PHP continue statement example:
<?phpIn 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
for($count=0; $count<=10; $count++)
{
if($count==5)
continue;
echo $count;
}
1234678910
Comments
Post a Comment