-
- //Given variables
- $city = "Heze";
- $province = "Shandong Province";
- $project = "PHP Program";
- $location_vars = array("province" , "city");
- //Create an array
- $result = compact("project", "nothing", "location_vars");
- print_r($result);
- ?>
Copy the code
at In the above program, because there is no variable named "nothing", the output of the program is as follows:
Array
(
[project] => PHP Program
[province] => Shandong Province
[city] => Heze
)
|