Learning PHP and MySQL

Example 04-17 Using continue instead of break

<?php
$counter  
=-  3;

for  (;  
$counter  <  10;  $counter++){
  
//  Check  for  division  by  zero 
  
if  ($counter  ==  0){
    
echo  "Skipping  to  avoid  division  by  zero.<br  />";
    continue;
  
}
  
echo  "100/$counter<br  />";
}
?>

Posted by on 08/03 at 08:16 AM

Next entry: Example 05-01 The ubiquitous Hello world!

Previous entry: Example 04-16 Using break to avoid division by zero

<< Back to main