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

<?php
$firstname = "Bill";
$lastname = "Gates";
$age = "60";

$result = compact("firstname", "lastname", "age");

print_r($result);
?>

==============================================
Array ( [firstname] => Bill [lastname] => Gates [age] => 60 )
posted @ 2019-07-18 12:00  戈丫汝  阅读(477)  评论(0编辑  收藏  举报