php 将几个变量合为数组,变量名和值对应

<?php
$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/gyrgyr/p/11206405.html