compact 创建一个包含变量名为数组的键和它们的值为数组的值的数组

$firstname = "Bill";
$lastname = "Gates";
$age = "60";
$result = compact("firstname", "lastname", "age");
print_r($result);
输出:
Array ( [firstname] => Bill [lastname] => Gates [age] => 60 )
原文地址:https://www.cnblogs.com/lichihua/p/7058218.html