Using the break Statement : break statement « Statement « PHP






Using the break Statement

 
<html>
<head><title>Using the break Statement</title></head>
<body>
<div>
<?php
    $counter = -4;
    for ( ; $counter <= 10; $counter++ ) {
      if ( $counter == 0 ) {
        break;
      }
      $temp = 4000/$counter;
      print "4000 divided by $counter is.. $temp<br />";
    }
?>
</div>
</body>
</html>
  
  








Related examples in the same category

1.Break statement
2.Breaking a Loop
3.Using the break Statement
4.Break 1 or break 2
5.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