This site is mobile accessible. Press the "Tap Here" button to use a different font-size.


Smartphone icons created by Freepik - Flaticon

PHP Loops

Break

The number is: 0
The number is: 1
The number is: 2
The number is: 3

<?php  
// Defines the 'for' loop
for ($x = 0; $x < 10; $x++) {
// breaks out of the loop when $x equals '4'
  if ($x == 4) {
    break;
  }
  echo "The number is: $x <br>";
}
?>