Loop through and print all the values of an associative array:


SUBMITTED BY: henry1874w

DATE: June 22, 2017, 12:02 a.m.

FORMAT: Text only

SIZE: 165 Bytes

HITS: 237

  1. <?php
  2. $age=array("Peter"=>"35","Ben"=>"37","Joe"=>"43");
  3. foreach($age as $x=>$x_value)
  4. {
  5. echo "Key=" . $x . ", Value=" . $x_value;
  6. echo "<br>";
  7. }
  8. ?>

comments powered by Disqus