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

derick Fri Jan 12 04:58:21 2001 EDT

  Modified files:
    /phpdoc/nl/functions array.xml
  Log:
  Fixed a missing >
  
  
Index: phpdoc/nl/functions/array.xml
diff -u phpdoc/nl/functions/array.xml:1.3 phpdoc/nl/functions/array.xml:1.4
--- phpdoc/nl/functions/array.xml:1.3 Wed Oct 18 15:13:07 2000
+++ phpdoc/nl/functions/array.xml Fri Jan 12 04:58:21 2001
@@ -15,8 +15,8 @@
    </simpara>
    <para>
     See also <function>is_array</function>, <function>explode</function>,
- <function>implode</function>, <function>split</function>
- and <function>join</function>.
+ <function>implode</function>, <function>split</function>
+ and <function>join</function>.
    </para>
   </partintro>
 
@@ -50,6 +50,14 @@
      </note>
     </para>
     <para>
+ Syntax "index =&gt; values", separated by commas, define index
+ and values. index may be of type string or numeric. When index is
+ omitted, a integer index is automatically generated, starting
+ at 0. If index is an integer, next generated index will
+ be the biggest integer index + 1. Note that when two identical
+ index are defined, the last overwrite the first.
+ </para>
+ <para>
      The following example demonstrates how to create a
      two-dimensional array, how to specify keys for associative
      arrays, and how to skip-and-continue numeric indices in normal
@@ -66,6 +74,54 @@
      </example>
     </para>
     <para>
+ <example>
+ <title>Automatic index with <function>Array</function></title>
+ <programlisting role="php">
+$array = array( 1, 1, 1, 1, 1, 8=>1, 4=>1, 19, 3=>13);
+print_r($array);
+ </programlisting>
+ </example>
+ which will display :
+ <informalexample>
+ <programlisting>
+Array
+(
+ [0] => 1
+ [1] => 1
+ [2] => 1
+ [3] => 13
+ [4] => 1
+ [8] => 1
+ [9] => 19
+)
+ </programlisting>
+ </informalexample>
+ Note that index '3' is defined twice, and keep its final value of 13.
+ Index 4 is defined after index 8, and next generated index (value 19)
+ is 9, since biggest index was 8.
+ </para>
+ <para>
+ This example creates a 1-based array.
+ <example>
+ <title>1-based index with <function>Array</function></title>
+ <programlisting role="php">
+ $firstquarter = array(1 => 'January', 'February', 'March');
+ print_r($firstquarter);
+ </programlisting>
+ </example>
+ which will display :
+ <informalexample>
+ <programlisting>
+Array
+(
+ [1] => 'January'
+ [2] => 'February'
+ [3] => 'March'
+)
+ </programlisting>
+ </informalexample>
+ </para>
+ <para>
      See also: <function>list</function>.
     </para>
    </refsect1>
@@ -1641,7 +1697,7 @@
      <example>
       <title><function>Extract</function> example</title>
       <programlisting role="php">
-&lt;php?
+&lt;?php
 
 /* Suppose that $var_array is an array returned from
    wddx_deserialize */
@@ -1697,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>
@@ -1705,6 +1762,12 @@
      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>
       <programlisting role="php">
@@ -1712,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>