We have 18 guests online
PHP Scripts arrow Free PHP Tutorials arrow Free PHP Tutorials arrow PHP Tutorials and Examples arrow PHP 
Free PHP Tutorials arrow PHP Tutorials and Examples arrow PHP

Cycling through an array of names with foreach
User Rating: / 5
PoorBest 

Using the foreach construct to cycle through an array.

  1. <?php
  2.     $namesList = array("aaron", "wally", "steve", "jeff", "andrew", "joivan");
  3.    
  4.     foreach($namesList as $name) {
  5.         echo $name . "<br />";
  6.     }
  7. ?>

 

 

Directory Stats

There are 1036 listing and 46 categories in our website

Change Language