mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
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:
parent
2685993b9f
commit
435459d19d
1 changed files with 26 additions and 0 deletions
|
@ -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 "'12.4' found with strict check\n";
|
||||
if (in_array(1.13, $a, true))
|
||||
echo "1.13 found with strict check\n";
|
||||
?>
|
||||
|
||||
// This will output:
|
||||
|
||||
1.13 found with strict check
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
Loading…
Reference in a new issue