Add docs about new functionality of extract().

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@39971 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Andrei Zmievski 2001-01-22 17:44:34 +00:00
parent 3cf34c1d63
commit c296e8a22f

View file

@ -1640,43 +1640,54 @@ while (list ($key, $val) = each ($HTTP_POST_VARS)) {
</para>
</note>
<para>
<function>Extract</function> checks for colissions with existing
variables. The way collisions are treated is determined by
<parameter>extract_type</parameter>. It can be one of the
<function>extract</function> checks each key to see whether if constitutes
a valid variable name and also for collisions with existing variables in
the symbol table. The way invalid/numeric keys and collisions are treated
is determined by <parameter>extract_type</parameter>. It can be one of the
following values:
<variablelist>
<varlistentry>
<term>EXTR_OVERWRITE</term>
<listitem>
<simpara>
If there is a collision, overwrite the existing variable.
</simpara>
<simpara>
If there is a collision, overwrite the existing variable.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>EXTR_SKIP</term>
<listitem>
<simpara>
If there is a collision, don't overwrite the existing
variable.
</simpara>
<simpara>
If there is a collision, don't overwrite the existing
variable.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>EXTR_PREFIX_SAME</term>
<listitem>
<simpara>
If there is a collision, prefix the new variable with
<parameter>prefix</parameter>.
</simpara>
<simpara>If there is a collision, prefix the variable name with
<parameter>prefix</parameter>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>EXTR_PREFIX_ALL</term>
<listitem>
<simpara>
Prefix all variables with <parameter>prefix</parameter>.
</simpara>
<simpara>
Prefix all variable names with <parameter>prefix</parameter>. Since PHP
4.0.5 this includes numeric ones as well.
</simpara>
</listitem>
</varlistentry>
</variablelist>
<varlistentry>
<term>EXTR_PREFIX_INVALID</term>
<listitem>
<simpara>
Only prefix invalid/numeric variable names with
<parameter>prefix</parameter>. This flag has been added in PHP 4.0.5.
</simpara>
</listitem>
</varlistentry>
</variablelist>
@ -1687,13 +1698,13 @@ while (list ($key, $val) = each ($HTTP_POST_VARS)) {
</para>
<para>
Note that <parameter>prefix</parameter> is only required if
<parameter>extract_type</parameter> is EXTR_PREFIX_SAME or
EXTR_PREFIX_ALL.
<parameter>extract_type</parameter> is EXTR_PREFIX_SAME, EXTR_PREFIX_ALL,
or EXTR_PREFIX_INVALID. If the prefixed result is not a valid variable
name, it is not imported into the symbol table.
</para>
<para>
<function>Extract</function> checks each key to see if it
constitues a valid variable name, and if it does only then does
it proceed to import it.
<function>extract</function> returns the number of variables successfully
imported into the symbol table.
</para>
<para>
A possible use for extract is to import into symbol table