diff --git a/functions/array.xml b/functions/array.xml index b61e75ffa4..715cc60a79 100644 --- a/functions/array.xml +++ b/functions/array.xml @@ -249,6 +249,26 @@ array_keys ($array, "blue"); // returns array (0, 3, 4) + + + This function was added to PHP4, below is an implementation for + those still using PHP3. + + + Implementation of <function>array_keys</function> for + PHP3 users + + +function array_keys($arr) { + $t = array(); + while (list($k,$v) = each($arr)) + $t[] = $k; + return $t; +} + + + + See also array_values. @@ -1004,6 +1024,26 @@ array_values ($array); // returns array ("XL", "gold") + + + This function was added to PHP4, below is an implementation for + those still using PHP3. + + + Implementation of <function>array_values</function> for + PHP3 users + + +function array_values($arr) { + $t = array(); + while (list($k,$v) = each($arr)) + $t[] = $v; + return $t; +} + + + +