Create an array from variables and their values in PHP
Description
The following code shows how to create an array from variables and their values.
Example
//from ww w.j a v a2s .c o m
<?php
$firstname = "XML";
$lastname = "HTML";
$age = "41";
$result = compact("firstname", "lastname", "age");
print_r($result);
?>
The code above generates the following result.