Learning PHP and MySQL

Example 06-09 Using extract on an associative array

<?php
$shapes
=array('SodaCan'  =>  'Cylinder',
              
'NotePad'  =>  'Rectangle',
              
'Apple'  =>  'Sphere',
              
'Orange'  =>  'Sphere',
              
'PhoneBook'  =>  'Rectangle');

extract($shapes);
//  $SodaCan,  $NotePad,  $Apple,  $Orange,  and  $PhoneBook  are  now  set echo  $Apple;
echo "<br>";
echo 
$NotePad;
?>

Posted by on 08/07 at 10:24 AM

Next entry: Example 06-10 Using extract with the EXTR_PREFIX_ALL directive

Previous entry: Example 06-08 Displaying a multidimensional array

<< Back to main