PHP continue Keyword
Example
Use continue
to skip over the "5" part of the code in a loop:
<?php
for($i = 1; $i <= 10; $i++) {
if($i == 5) {
continue;
}
echo "$i <br>";
}
?>
Try it Yourself »
Definition and Usage
The continue
keyword is used to is used to end the current iteration in a for
, foreach
, while
or do..while
loop, and continues to the next iteration.
Related Pages
Use the break
keyword to end the loop completely
Read more about break and continue in our PHP Break and Continue Tutorial.
Read more about loops in our PHP Loops Tutorial.
❮ PHP Keywords