1、compact() 函数创建包含变量名和它们的值的数组。
<?php $firstname = "Bill"; $lastname = "Gates"; $age = "60"; $result =compact("firstname", "lastname", "age")
; print_r($result); ?>
2、extract() 函数从数组中将变量导入到当前的符号表。
<?php
$a = "Original";
$my_array = array("a" => "Cat","b" => "Dog", "c" => "Horse");
extract($my_array);
echo "\$a = $a; \$b = $b; \$c = $c";
?>