cvs: phpdoc /en/functions array.xml

From: Date: Fri, 11 Jan 2002 13:18:50 +0000
Subject: cvs: phpdoc /en/functions array.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969341079@lists.php.net to get a copy of this message
derick Fri Jan 11 08:18:50 2002 EDT Modified files: /phpdoc/en/functions array.xml Log: - Added documentation/example for the use as an array as the first parameter to in_array(). Index: phpdoc/en/functions/array.xml diff -u phpdoc/en/functions/array.xml:1.151 phpdoc/en/functions/array.xml:1.152 --- phpdoc/en/functions/array.xml:1.151 Wed Jan 9 19:07:21 2002 +++ phpdoc/en/functions/array.xml Fri Jan 11 08:18:50 2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.151 $ --> +<!-- $Revision: 1.152 $ --> <reference id="ref.array"> <title>Array Functions</title> <titleabbrev>Arrays</titleabbrev> @@ -2886,6 +2886,12 @@ a case-sensitive manner. </para> </note> + <note> + <para> + In PHP versions before 4.2.0 <parameter>needle</parameter> was not + allowed to be an array. + </para> + </note> <para> <example> <title><function>in_array</function> example</title> @@ -2901,7 +2907,7 @@ ]]> </programlisting> <para> - The second condition fails because <function>in_array()</function> + The second condition fails because <function>in_array</function> is case-sensitive, so the program above will display: <screen role="php"> <![CDATA[ @@ -2934,6 +2940,30 @@ ]]> </screen> </para> + </example> + </para> + <para> + <example> + <title><function>in_array</function> with an array as needle</title> + <programlisting role="php"> +<![CDATA[ +<?php +$a = array(array('p', 'h'), array('p', 'r'), 'o'); + +if (in_array(array ('p', 'h'), $a)) + echo "'ph' is found\n"; +if (in_array(array ('f', 'i'), $a)) + echo "'fi' is not found\n"; +if (in_array('o', $a)) + echo "'o' is found\n"; +?> + +// This will output: + +'ph' is found +'o' is found +]]> + </programlisting> </example> </para> <para>

« previous php.doc (#969341079) next »