From c296e8a22fd3772533c15cd60e4d065a247aca1b Mon Sep 17 00:00:00 2001 From: Andrei Zmievski Date: Mon, 22 Jan 2001 17:44:34 +0000 Subject: [PATCH] Add docs about new functionality of extract(). git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@39971 c90b9560-bf6c-de11-be94-00142212c4b1 --- functions/array.xml | 55 +++++++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/functions/array.xml b/functions/array.xml index f2635e3860..21008de6eb 100644 --- a/functions/array.xml +++ b/functions/array.xml @@ -1640,43 +1640,54 @@ while (list ($key, $val) = each ($HTTP_POST_VARS)) { - Extract checks for colissions with existing - variables. The way collisions are treated is determined by - extract_type. It can be one of the + extract 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 extract_type. It can be one of the following values: EXTR_OVERWRITE - - If there is a collision, overwrite the existing variable. - + + If there is a collision, overwrite the existing variable. + EXTR_SKIP - - If there is a collision, don't overwrite the existing - variable. - + + If there is a collision, don't overwrite the existing + variable. + EXTR_PREFIX_SAME - - If there is a collision, prefix the new variable with - prefix. - + If there is a collision, prefix the variable name with + prefix. + EXTR_PREFIX_ALL - - Prefix all variables with prefix. - + + Prefix all variable names with prefix. Since PHP + 4.0.5 this includes numeric ones as well. + + + + + + EXTR_PREFIX_INVALID + + + Only prefix invalid/numeric variable names with + prefix. This flag has been added in PHP 4.0.5. + @@ -1687,13 +1698,13 @@ while (list ($key, $val) = each ($HTTP_POST_VARS)) { Note that prefix is only required if - extract_type is EXTR_PREFIX_SAME or - EXTR_PREFIX_ALL. + extract_type 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. - Extract checks each key to see if it - constitues a valid variable name, and if it does only then does - it proceed to import it. + extract returns the number of variables successfully + imported into the symbol table. A possible use for extract is to import into symbol table