continue;
Break ends a loop completely,where as continue skip the current iteration and moves on to the next iteration. while ($number) { <--------------- continue; --- goes back here - break; ----- jumps here --- }<---------------------------- |
<?php for ($i = 1; $i <= 10; $i++) { if($i<=5) echo $i."<br>"; else continue; ?>
Output
1 2 3 4 5
<?php $number = 1; while ($number++) { if ($number == 2) { continue; } if ($number == 6) { break; } echo $number . "<br>"; } ?>
Output
3 4 5