php 将几个变量合为数组,变量名和值对应
<?php $firstname = "Bill"; $lastname = "Gates"; $age = "60"; $result = compact("firstname", "lastname", "age"); print_r($result); ?>
==============================================
Array ( [firstname] => Bill [lastname] => Gates [age] => 60 )