This function takes a number of variable arguments, each variable can be a string containing the name of the variable or the array name of the variable, and the array can contain the array name of the other variable.
This function looks for the variable name in the symbol table and adds it to the output array so that the name of the variable becomes the index value and the content of the variable becomes the value of the index value, which, in contrast to extract (), returns the output array.
Example:
<?php
$city = "San Francisco";
$state = "CA";
$event = "SIGGRAPH";
$location _vars = Array ("City", "state");
$result = Compact ("event", $location _vars);
?>
After that, $result will be array ("event" => "SIGGRAPH", "City" => "San Francisco", "state" => "CA")
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.