English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The extract() function imports variables from an array into the current symbol table
extract($array, $extract_type, $prefix)
This function is used to import variables from an array into the current symbol table. It takes an associated array of arrays, and treats the keys as variable names and the values as variable values. For each key/Value pair, it will create a variable in the current symbol table, constrained by the extract_type and prefix parameters.
Nummer | Parameter und Beschreibung |
---|---|
1 | array (notwendig) Es wird ein Array angegeben |
2 | extract_type (optional) Die Funktion extract() überprüft ungültige Variablennamen und Konflikte mit bestehenden Variablennamen. Dieser Parameter bestimmt, wie ungültige und konfliktive Namen behandelt werden. Mögliche Werte:
|
3 | Präfix (optional) Wenn EXTR_PREFIX_SAME, EXTR_PREFIX_ALL, EXTR_PREFIX_INVALID oder EXTR_PREFIX_IF_EXISTS in den extract_rules-Parameter verwendet wird, ist der angegebene Präfix erforderlich. Dieser Parameter bestimmt den Präfix. Der Präfix wird automatisch durch Unterstriche mit den Array-Schlüsseln getrennt. |
Rückgabewert: Die Anzahl der Variablen, die erfolgreich in das Symboltableingefügt wurden.
"blau", "size" => "mittel", "shape" => "Kugel"); extract($input, EXTR_PREFIX_SAME, "bbcx"); echo "$color, $size, $shape, $bbcx_size"; ?>Testen Sie heraus‹/›
Ausgaberesultat:
blau, groß, Kugel, mittel