Extract
(PHP3 >= 3.0.7, PHP4)
Array_extract---&http://www.aliyun.com/zixun/aggregation/37954.html ">nbsp; Entering variables from an array into a symbol table
Syntax: void extract (array var_array, int [extract_type], string [prefix]);
Description:
This function from an array input variable to the current symbol table, which takes an array Var_array and treats the index value as the variable name, and the value as the variable value, which sets the key/value pairs to a variable in the current symbol table to Extract_ Type and prefix are the conditions.
Extract () examines the existing variables, which, by parameter extract, determine how they are handled during collisions, which can be one of the following values:
Extr_overwrite
If a collision occurs, the existing variables are overwritten.
Extr_skip
If a collision occurs, it does not cover existing variables.
Extr_prefix_same
If a collision occurs, the parameter prefix is added to the top of the word to become a new variable.
Extr_prefix_all
Add parameters to the capital of all variables prefix
If no parameter extract_type is specified, the extr_overwrite is used.
Note: Parameter PREFIX is required when Extract_type is Extr_prefix_same or Extr_prefix_all.
Example:
<?php
/* Suppose that $var _array is a array returned from Wddx_deserialize * *
$size = "SCM";
$var _array = Array ("Color" => "blue", "Size" => "medium", "shape" => "sphere");
Extract ($var _array, Extr_prefix_same, "WDDX");
Print "$color, $size, $shape, $wddx _size\n";
?>
The example above will produce:
Blue, SCM, sphere, medium.
$size does not cover the past because we have specified extr_prefix_same, and the results in $wddx_size have been established, and if Extr_skip is used, $wddx_size will not be established, if Extr_overwrite is used $ The value of size is medium, and if you use Extr_prefix_all there will be a new variable named $wddx_color, $wddx _size, and $wddx_shape.