Break Statement : break statement « Statement « PHP






Break Statement

 
<html>
 <head>
  <title>Break Statement</title>
 </head>
 <body>

 <?php
  $i = 0;

  while ( $i < 6 )
  {
    if( $i == 3) break;
    $i++;
  }
  echo("Loop stopped at $i by break statement");
 ?>

 </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.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