dave Mon Dec 15 14:16:06 2003 EDT
Modified files: /phpdoc/en/reference/array/functions array-search.xml Log: - Add a note about case-sensitivity, fix #26539. Index: phpdoc/en/reference/array/functions/array-search.xml diff -u phpdoc/en/reference/array/functions/array-search.xml:1.5 phpdoc/en/reference/array/functions/array-search.xml:1.6 --- phpdoc/en/reference/array/functions/array-search.xml:1.5 Fri Jul 25 12:38:56 2003 +++ phpdoc/en/reference/array/functions/array-search.xml Mon Dec 15 14:16:05 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.array-search"> <refnamediv> @@ -24,6 +24,12 @@ </para> <note> <para> + If <parameter>needle</parameter> is a string, the comparison is done + in a case-sensitive manner. + </para> + </note> + <note> + <para> Prior to PHP 4.2.0, <function>array_search</function> returns <constant>NULL</constant> on failure instead of &false;. </para> @@ -34,6 +40,28 @@ will also check the types of the <parameter>needle</parameter> in the <parameter>haystack</parameter>. </para> + <para> + If <parameter>needle</parameter> is found in + <parameter>haystack</parameter> more than once, the first matching key + is returned. To return the keys for all matching values, use + <function>array_keys</function> with the optional + <parameter>search_value</parameter> parameter instead. + </para> + <para> + <example> + <title><function>array_search</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +$array = array(0 => "blue", 1 => "red", 2 => "green", 3 => "red"); + +$key = array_search($array, "green")); // $key = 2; +$key = array_search($array, "red")); // $key = 1; +?> +]]> + </programlisting> + </example> + </para> &return.falseproblem; <para> See also <function>array_keys</function>,