-
- //导出数组为变量
- $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";
- ?>
复制代码
输出结果:
$a = Cat; $b = Dog; $c = Horse
例2,使用全部参数:
-
-
$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;";
- ?>
-
复制代码
输出结果:
$a = Original; $b = Dog; $c = Horse; $dup_a = Cat;
|