continue is used within looping structures to skip the rest of the current loop iteration and continue execution at the condition evaluation and then the beginning of the next iteration.
continue;
Following example demonstrate of 1, 2, 3, 4, ram game we play in childhood. here we will check condition, if $i % 5
is 0
then it will print ram and skip loop. it means it will continue from beginning of loop.
<?php
for ($i = 1; $i <= 20; $i++) {
if ($i % 5 == 0) {
echo 'ram<br />';
continue;
}
echo $i.'<br />';
}
?>
Ask Question