-
- //Export the array as a variable
- $a = 'Original';
- $my_array = array("a" => "Cat","b" => "Dog", "c" => "Horse");
- extract($my_array); // bbs.it-home.org
- echo "$a = $a; $b = $b; $c = $c";
- ?>
Copy the code
Output results:
$a = Cat; $b = Dog; $c = Horse
Example 2, using all parameters:
-
-
$a = 'Original'; - $my_array = array("a" => "Cat","b" => "Dog", " c" => "Horse");
extract($my_array, EXTR_PREFIX_SAME, 'dup');
echo "$a = $a; $b = $b; $c = $c; $dup_a = $dup_a;";
- ?>
-
Copy the code
output result:
$a = Original; $b = Dog; $c = Horse; $dup_a = Cat;
|