Extracting Values from an Array Using list() : list « Utility Function « PHP






Extracting Values from an Array Using list()

 
<?php
  $scores = array(88, 75, 91, 84);

  list($maths, $english, $history, $biology) = $scores;

  printf("<p>Maths: %d; English: %d; History: %d; Biology: %d.</p>\n",
          $maths, $english, $history, $biology);
?>
  
  








Related examples in the same category

1.list($maths, $english, , $biology) = $scores;
2.Using the list() function.
3.Each line is converted into an array