Advertisement
aldinokemal

Break and Continue

Sep 25th, 2022
808
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. $counter = 1;
  4. while (true) {
  5.     echo "Hello Break: " . $counter;
  6.     $counter++;
  7.  
  8.     if ($counter > 10) {
  9.         break;
  10.     }
  11. }
  12.  
  13.  
  14. for ($counter = 0; $counter <= 100; $counter++) {
  15.     if ($counter % 2 == 0) {
  16.         continue;
  17.     }
  18.     echo "Hello Continue" . $counter;
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement