Using foreach to Iterate through an Array : Array Loop : Data Structure PHP Source Code


PHP Source Code » Data Structure » Array Loop »

 

Using foreach to Iterate through an Array



<?php
     $prog_language[] "PHP";
     $prog_language[] "C";
     $prog_language[] "C++";
     $prog_language[] "Java";
     $prog_language[] "Forth";
     $prog_language[] "Perl";
     $prog_language[] "Python";
     $prog_language[] "Ruby";
   
     foreach($prog_language as $language)
     {
          if(!strcmp($language, "PHP")){
               print("<b>" . $language . "</b> <br />");
          }else{
               print($language . " <br />");
          }
     }
?>

           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo Data Structure
» Array Loop