Create an array with string that does not match a variable, and an array of variable names in PHP
Description
The following code shows how to create an array with string that does not match a variable, and an array of variable names.
Example
/* w w w . jav a 2 s. c o m*/
<?php
$firstname = "XML";
$lastname = "HTML";
$age = "41";
$name = array("firstname", "lastname");
$result = compact($name, "location", "age");
print_r($result);
?>
The code above generates the following result.