Compact
(PHP4)
Compact---&http://www.aliyun.com/zixun/aggregation/37954.html ">nbsp; Create an array containing variables and their values
Syntax: Array compact (string VarName | array varnames, [...]);
Description:
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")
Reference: Extract ()