Breaking a Loop : break statement « Statement « PHP






Breaking a Loop


<?php
  for ($a = 1; $a <= 20; $a++){
      $divide = 40/$a;
      echo "The result of dividing 40 by $a is $divide", "<br>";
  }
?>

           
       








Related examples in the same category

1.Break statement
2.Using the break Statement
3.Break 1 or break 2
4.Break Statement
5.Using the break Statement
6.The break command applies to both loops and switch/case statements
7.break within a for loop
8.Using break to avoid division by zero