|
extractImport variables into the current symbol table from an array Description
int extract
( array
&$array
[, int $flags = EXTR_OVERWRITE
[, string $prefix = NULL
]] )Import variables from an array into the current symbol table. Checks each key to see whether it has a valid variable name. It also checks for collisions with existing variables in the symbol table. Parameters
Return ValuesReturns the number of variables successfully imported into the symbol table. Examples
Example #1 extract example A possible use for extract is to import into the symbol table variables contained in an associative array returned by wddx_deserialize.
<?php The above example will output: blue, large, sphere, medium
The $size wasn't overwritten because we specified
NotesWarning
Do not use extract on untrusted data, like
user input
(i.e. $_GET, $_FILES, etc.).
If you do, for example if you want to temporarily run old code that
relied on register_globals,
make sure you use one of the non-overwriting
See Also
|