Break statement : Break : Language Basics PHP Source Code


PHP Source Code » Language Basics » Break »

 

Break statement




<?php
   $primes = array(2,3,5,7,11,13,17,19,23,29,31,37,41,43,47);
   for($count = 1; $count++; $count < 1000) {
      $randomNumber = rand(1,50);
      if (in_array($randomNumber,$primes)) {
         break;
      else {
         echo "<p>Non-prime number encountered: $randomNumber</p>";
      }
   }
?>

           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo Language Basics
» Break