[PHP-DOC] cvs: phpdoc /en/functions array.xml From: Derick Rethans (d.rethans <email protected>)
Date: 01/07/01

derick Sun Jan 7 15:32:24 2001 EDT

  Modified files:
    /phpdoc/en/functions array.xml
  Log:
  Clarification of the strict parameter of in_array
  
  
Index: phpdoc/en/functions/array.xml
diff -u phpdoc/en/functions/array.xml:1.46 phpdoc/en/functions/array.xml:1.47
--- phpdoc/en/functions/array.xml:1.46 Tue Dec 12 20:51:17 2000
+++ phpdoc/en/functions/array.xml Sun Jan 7 15:32:24 2001
@@ -1753,6 +1753,7 @@
       <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 @@
      <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>
@@ -1768,6 +1775,25 @@
 if (in_array ("Irix", $os)){
     print "Got Irix";
     }
+ </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>