Create an array from variables and their values:
$firstname = "Peter";
$lastname = "Griffin";
$age = "41";
$result = compact("firstname", "lastname", "age");
print_r($result);
Array ( [firstname] => Peter [lastname] => Griffin [age] => 41 )
No comments:
Post a Comment