Clarification of the strict parameter of in_array

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@38843 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Derick Rethans 2001-01-07 23:32:24 +00:00
parent 2685993b9f
commit 435459d19d

View file

@ -1753,6 +1753,7 @@ blue, large, sphere, medium
<funcdef>bool in_array</funcdef>
<paramdef>mixed <parameter>needle</parameter></paramdef>
<paramdef>array <parameter>haystack</parameter></paramdef>
<paramdef>bool <parameter>strict</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
@ -1760,6 +1761,12 @@ blue, large, sphere, medium
<parameter>needle</parameter> and returns true if it is found in
the array, false otherwise.
</para>
<para
If the third parameter <parameter>strict</parameter> is set to
<literal>TRUE</literal> then the <function>in_array</function>
will also check the types of the <parameter>needle</parameter>
in the <parameter>haystack</parameter>.
</para>
<para>
<example>
<title><function>In_array</function> example</title>
@ -1771,6 +1778,25 @@ if (in_array ("Irix", $os)){
</programlisting>
</example>
</para>
<para>
<example>
<title><function>In_array</function> with strict example</title>
<programlisting role="php">
<?php
$a = array('1.10', 12.4, 1.13);
if (in_array('12.4', $a, true))
echo &quot;'12.4' found with strict check\n&quot;;
if (in_array(1.13, $a, true))
echo &quot;1.13 found with strict check\n&quot;;
?>
// This will output:
1.13 found with strict check
</programlisting>
</example>
</para>
</refsect1>
</refentry>