From d0fefa8d9437d8dc262ef9dcb07d5732d15a6083 Mon Sep 17 00:00:00 2001 From: Mehdi Achour Date: Wed, 12 Nov 2003 21:06:32 +0000 Subject: [PATCH] fixing #26225 adding an example correcting the callback parameter name git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@144208 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/array/functions/array-filter.xml | 45 +++++++++++++++++++++- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/reference/array/functions/array-filter.xml b/reference/array/functions/array-filter.xml index 24be7ba8c6..5592dfc125 100644 --- a/reference/array/functions/array-filter.xml +++ b/reference/array/functions/array-filter.xml @@ -1,5 +1,5 @@ - + @@ -13,7 +13,7 @@ arrayarray_filter arrayinput - callbackfunction + callbackcallback array_filter iterates over each value in @@ -77,6 +77,47 @@ Array array_filter is applied to. If the array is changed, the behavior of this function is undefined. + + If the callback function is not supplied, + array_filter will remove all the entries of + input that are equal to &false;. See converting to boolean + for more information. + + + + <function>array_filter</function> without + <parameter>callback</parameter> + + 'foo', + 1 => false, + 2 => -1, + 3 => null, + 4 => '' + ); + +print_r(array_filter($entry)); +?> +]]> + + + This will output : + + + foo + [2] => -1 +) +]]> + + + See also array_map, array_reduce, and array_walk.