Using extract with the EXTR_PREFIX_ALL directive
<?php
$Apple="Computer";
$shapes=array('S' => 'Cylinder',
'N' => 'Rectangle',
'A' => 'Sphere',
'O' => 'Sphere',
'P' => 'Rectangle');
extract($shapes,EXTR_PREFIX_ALL,"shapes");
echo "Apple is $Apple.<br />";
echo "Shapes_Apple is $shapes_Apple";
echo "<br />";
echo "Shapes_NotePad is $shapes_NotePad";
?>
Related examples in the same category