List array values : Array Loop « Data Structure « PHP






List array values

 
<html>
 <head>
  <title>List array values</title>
 </head>
 <body> 
  <ol>

  <?php
  $arr = array( "Red", "Green", "Blue" );

  foreach( $arr as $value ) 
  {
    echo("<li>Do you like $value ?</li>");
  }
  ?>

  </ol> 
 </body>
</html>
  
  








Related examples in the same category

1.Using foreach to Iterate through an Array
2.Looping through an Enumerated Array
3.Looping Through a Compact Indexed Array Using for and count()
4.Looping Through a Multidimensional Array
5.Looping Through a Sparse Array
6.Looping Through an Associative Array with foreach
7.Looping Through the $_SERVER Array
8.Looping through child elements with foreach()
9.Looping through identically named elements with foreach()
10.Looping with foreach()