didou Wed Nov 12 16:06:33 2003 EDT
Modified files: /phpdoc/en/reference/array/functions array-filter.xml Log: fixing #26225 adding an example correcting the callback parameter name Index: phpdoc/en/reference/array/functions/array-filter.xml diff -u phpdoc/en/reference/array/functions/array-filter.xml:1.12 phpdoc/en/reference/array/functions/array-filter.xml:1.13 --- phpdoc/en/reference/array/functions/array-filter.xml:1.12 Sun Aug 17 08:21:03 2003 +++ phpdoc/en/reference/array/functions/array-filter.xml Wed Nov 12 16:06:32 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.12 $ --> +<!-- $Revision: 1.13 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.62 --> <refentry id="function.array-filter"> <refnamediv> @@ -13,7 +13,7 @@ <methodsynopsis> <type>array</type><methodname>array_filter</methodname> <methodparam><type>array</type><parameter>input</parameter></methodparam> - <methodparam choice="opt"><type>callback</type><parameter>function</parameter></methodparam> + <methodparam choice="opt"><type>callback</type><parameter>callback</parameter></methodparam> </methodsynopsis> <para> <function>array_filter</function> iterates over each value in @@ -76,6 +76,47 @@ function. e.g. Add/delete an element, unset the array that <function>array_filter</function> is applied to. If the array is changed, the behavior of this function is undefined. + </para> + <para> + If the <parameter>callback</parameter> function is not supplied, + <function>array_filter</function> will remove all the entries of + <parameter>input</parameter> that are equal to &false;. See <link + linkend="language.types.boolean.casting">converting to boolean</link> + for more information. + </para> + <para> + <example> + <title><function>array_filter</function> without + <parameter>callback</parameter></title> + <programlisting role="php"> +<![CDATA[ +<?php + +$entry = array( + 0 => 'foo', + 1 => false, + 2 => -1, + 3 => null, + 4 => '' + ); + +print_r(array_filter($entry)); +?> +]]> + </programlisting> + <para> + This will output : + </para> + <screen> +<![CDATA[ +Array +( + [0] => foo + [2] => -1 +) +]]> + </screen> + </example> </para> <para> See also <function>array_map</function>,