Convert associative array to separate variables named by keys and On collision, the variable name will be given a prefix in PHP
Description
The following code shows how to convert associative array to separate variables named by keys and On collision, the variable name will be given a prefix.
Example
<?php/*from w ww . j a va 2s . co m*/
$a = "Original";
$my_array = array("a" => "Red", "b" => "Dog", "c" => "Horse");
extract($my_array, EXTR_PREFIX_SAME, "dup");
echo "\$a = $a; \$b = $b; \$c = $c; \$dup_a = $dup_a";
?>
The code above generates the following result.