example array

  1. <?php
  2.  
  3. $arr = array(A, B, C, D); // this is an example array
  4.  
  5. // this loops through an array printing out each value
  6. foreach ($arr as $value) {  
  7.     print $value . ', '; // prints out A, B, C, D,
  8. }
  9.  
  10.  
  11. // this references an array and prints out a selected value
  12. print $arr[0]; // prints the first value in the array A
  13. print $arr[2]; // prints the third value in the array C
  14.  
  15. ?>