[PHP-DOC] cvs: phpdoc /it/functions array.xml From: Luca Perugini (l.perugini <email protected>)
Date: 08/31/00

perugini Thu Aug 31 09:00:21 2000 EDT

  Modified files:
    /phpdoc/it/functions array.xml
  Log:
  Sync with en tree.
  
  
Index: phpdoc/it/functions/array.xml
diff -u phpdoc/it/functions/array.xml:1.5 phpdoc/it/functions/array.xml:1.6
--- phpdoc/it/functions/array.xml:1.5 Mon Jul 3 09:39:12 2000
+++ phpdoc/it/functions/array.xml Thu Aug 31 09:00:21 2000
@@ -1,6 +1,19 @@
  <reference id="ref.array">
- <title>Array functions</title>
+ <title>Array Functions</title>
   <titleabbrev>Arrays</titleabbrev>
+ <partintro>
+ <simpara>
+ These functions allow you to interact with and manipulate
+ arrays in various ways. Arrays are essential for storing,
+ managing, and operating on sets of variables.
+ </simpara>
+ <simpara>
+ Simple and multi-dimensional arrays are supported, and may be
+ either user created or created by another function.
+ There are specific database handling functions for populating
+ arrays from database queries, and several functions return arrays.
+ </simpara>
+ </partintro>
 
   <refentry id="function.array">
    <refnamediv>
@@ -14,15 +27,19 @@
     <funcsynopsis>
      <funcprototype>
       <funcdef>array <function>array</function></funcdef>
- <varargs/>
+ <paramdef>mixed
+ <parameter><optional>...</optional></parameter>
+ </paramdef>
      </funcprototype>
     </funcsynopsis>
     <para>
      Returns an array of the parameters. The parameters can be given
      an index with the <literal>=&gt;</literal> operator.
+ </para>
+ <para>
      <note>
       <para>
- <function>array</function> is a language construct used to
+ <function>Array</function> is a language construct used to
        represent literal arrays, and not a regular function.
       </para>
      </note>
@@ -33,12 +50,12 @@
      arrays, and how to skip-and-continue numeric indices in normal
      arrays.
      <example>
- <title><function>array</function> example</title>
+ <title><function>Array</function> example</title>
       <programlisting role="php">
 $fruits = array (
- "fruits" => array("a"=>"orange", "b"=>"banana", "c"=>"apple"),
- "numbers" => array(1, 2, 3, 4, 5, 6),
- "holes" => array("first", 5 => "second", "third")
+ "fruits" => array ("a"=>"orange", "b"=>"banana", "c"=>"apple"),
+ "numbers" => array (1, 2, 3, 4, 5, 6),
+ "holes" => array ("first", 5 => "second", "third")
 );
       </programlisting>
      </example>
@@ -63,23 +80,61 @@
      </funcprototype>
     </funcsynopsis>
     <para>
- <function>array_count_values</function> returns an array using
+ <function>Array_count_values</function> returns an array using
      the values of the <parameter>input</parameter> array as keys and
      their frequency in <parameter>input</parameter> as values.
     </para>
     <para>
      <example>
- <title><function>array_count_values</function> example</title>
+ <title><function>Array_count_values</function> example</title>
       <programlisting role="php">
-$array = array(1, "hello", 1, "world", "hello");
-array_count_values($array); // returns array(1=>2, "hello"=>2, "world"=>1)
+$array = array (1, "hello", 1, "world", "hello");
+array_count_values ($array); // returns array (1=>2, "hello"=>2, "world"=>1)
       </programlisting>
      </example>
- <note>
- <para>
- This function was added in PHP 4.0.
- </para>
- </note>
+ </para>
+ </refsect1>
+ </refentry>
+
+ <refentry id="function.array-diff">
+ <refnamediv>
+ <refname>array_diff</refname>
+ <refpurpose>Computes the difference of arrays</refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Description</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>array <function>array_diff</function></funcdef>
+ <paramdef>array <parameter>array1</parameter></paramdef>
+ <paramdef>array <parameter>array2</parameter></paramdef>
+ <paramdef>array
+ <parameter><optional> ...</optional></parameter>
+ </paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ <function>Array_diff</function> returns an array
+ containing all the values of <parameter>array1</parameter>
+ that are not present in any of the other arguments.
+ Note that keys are preserved.
+ </para>
+ <para>
+ <example>
+ <title><function>Array_diff</function> example</title>
+ <programlisting role="php">
+$array1 = array ("a" => "green", "red", "blue");
+$array2 = array ("b" => "green", "yellow", "red");
+$result = array_diff ($array1, $array2);
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ This makes <varname>$result</varname> have <literal>array
+ ("blue");</literal>
+ </para>
+ <para>
+ See also <function>array_intersect</function>.
     </para>
    </refsect1>
   </refentry>
@@ -98,25 +153,63 @@
      </funcprototype>
     </funcsynopsis>
     <para>
- <function>array_flip</function> returns an array in flip order.
+ <function>Array_flip</function> returns an array in flip order.
     </para>
     <para>
      <example>
- <title><function>array_flip</function> example</title>
+ <title><function>Array_flip</function> example</title>
       <programlisting role="php">
 $trans = array_flip ($trans);
 $original = strtr ($str, $trans);
       </programlisting>
      </example>
- <note>
- <para>
- This function was added in PHP 4.0.
- </para>
- </note>
     </para>
    </refsect1>
   </refentry>
 
+ <refentry id="function.array-intersect">
+ <refnamediv>
+ <refname>array_intersect</refname>
+ <refpurpose>Computes the intersection of arrays</refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Description</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>array <function>array_intersect</function></funcdef>
+ <paramdef>array <parameter>array1</parameter></paramdef>
+ <paramdef>array <parameter>array2</parameter></paramdef>
+ <paramdef>array
+ <parameter><optional> ...</optional></parameter>
+ </paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ <function>Array_intersect</function> returns an array
+ containing all the values of <parameter>array1</parameter>
+ that are present in all the arguments.
+ Note that keys are preserved.
+ </para>
+ <para>
+ <example>
+ <title><function>Array_intersect</function> example</title>
+ <programlisting role="php">
+$array1 = array ("a" => "green", "red", "blue");
+$array2 = array ("b" => "green", "yellow", "red");
+$result = array_intersect ($array1, $array2);
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ This makes <varname>$result</varname> have <literal>array ("a"
+ => "green", "red");</literal>
+ </para>
+ <para>
+ See also <function>array_diff</function>.
+ </para>
+ </refsect1>
+ </refentry>
+
   <refentry id="function.array-keys">
    <refnamediv>
     <refname>array_keys</refname>
@@ -136,7 +229,7 @@
      </funcprototype>
     </funcsynopsis>
     <para>
- <function>array_keys</function> returns the keys, numeric and
+ <function>Array_keys</function> returns the keys, numeric and
      string, from the <parameter>input</parameter> array.
     </para>
     <para>
@@ -146,23 +239,18 @@
     </para>
     <para>
      <example>
- <title><function>array_keys</function> example</title>
+ <title><function>Array_keys</function> example</title>
       <programlisting role="php">
-$array = array(0 => 100, "color" => "red");
+$array = array (0 => 100, "color" => "red");
 array_keys ($array); // returns array (0, "color")
 
-$array = array(1, 100, 2, 100);
-array_keys ($array, 100); // returns array (0, 2)
+$array = array ("blue", "red", "green", "blue", "blue");
+array_keys ($array, "blue"); // returns array (0, 3, 4)
       </programlisting>
      </example>
     </para>
     <para>
      See also <function>array_values</function>.
- <note>
- <para>
- This function was added in PHP 4.0.
- </para>
- </note>
     </para>
    </refsect1>
   </refentry>
@@ -179,13 +267,13 @@
       <funcdef>array <function>array_merge</function></funcdef>
       <paramdef>array <parameter>array1</parameter></paramdef>
       <paramdef>array <parameter>array2</parameter></paramdef>
- <paramdef>
- <parameter><optional> ...</optional></parameter>
+ <paramdef>array
+ <parameter><optional>...</optional></parameter>
       </paramdef>
      </funcprototype>
     </funcsynopsis>
     <para>
- <function>array_merge</function> merges the elements of two or
+ <function>Array_merge</function> merges the elements of two or
      more arrays together so that the values of one are appended to
      the end of the previous one. It returns the resulting array.
     </para>
@@ -203,20 +291,177 @@
 $array2 = array ("a", "b", "color" => "green", "shape" => "trapezoid", 4);
 array_merge ($array1, $array2);
       </programlisting>
- <para>
- Resulting array will be array("color" => "green", 2, 4, "a",
- "b", "shape" => "trapezoid", 4).
- </para>
      </example>
- <note>
- <para>
- This function was added in PHP 4.0.
- </para>
- </note>
     </para>
+ <para>
+ Resulting array will be <literal>array("color" => "green", 2, 4,
+ "a", "b", "shape" => "trapezoid", 4)</literal>.
+ </para>
+ <para>
+ See also <function>array_merge_recursive</function>.
+ </para>
+ </refsect1>
+ </refentry>
+
+ <refentry id="function.array-merge-recursive">
+ <refnamediv>
+ <refname>array_merge_recursive</refname>
+ <refpurpose>Merge two or more arrays recursively</refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Description</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>array <function>array_merge_recursive</function></funcdef>
+ <paramdef>array <parameter>array1</parameter></paramdef>
+ <paramdef>array <parameter>array2</parameter></paramdef>
+ <paramdef>array
+ <parameter><optional>...</optional></parameter>
+ </paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ <function>Array_merge_recursive</function> merges the elements of
+ two or more arrays together so that the values of one are appended
+ to the end of the previous one. It returns the resulting array.
+ </para>
+ <para>
+ If the input arrays have the same string keys, then the values for
+ these keys are merged together into an array, and this is done
+ recursively, so that if one of the values is an array itself, the
+ function will merge it with a corresponding entry in another array
+ too. If, however, the arrays have the same numeric key, the later
+ value will not overwrite the original value, but will be appended.
+ </para>
+ <para>
+ <example>
+ <title><function>Array_merge_recursive</function> example</title>
+ <programlisting role="php">
+$ar1 = array ("color" => array ("favorite" => "red"), 5);
+$ar2 = array (10, "color" => array ("favorite" => "green", "blue"));
+$result = array_merge_recursive ($ar1, $ar2);
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ Resulting array will be <literal>array ("color" => array
+ ("favorite" => array ("red", "green"), "blue"), 5, 10)</literal>.
+ </para>
+ <para>
+ See also <function>array_merge</function>.
+ </para>
    </refsect1>
   </refentry>
 
+ <refentry id="function.array-multisort">
+ <refnamediv>
+ <refname>array_multisort</refname>
+ <refpurpose>Sort multiple or multi-dimensional arrays</refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Description</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>bool <function>array_multisort</function></funcdef>
+ <paramdef>array <parameter>ar1</parameter></paramdef>
+ <paramdef>mixed
+ <parameter><optional>arg</optional></parameter>
+ </paramdef>
+ <paramdef>mixed
+ <parameter><optional>...</optional></parameter>
+ </paramdef>
+ <paramdef>array
+ <parameter><optional>...</optional></parameter>
+ </paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ <function>Array_multisort</function> can be used to sort several
+ arrays at once or a multi-dimensional array according by one of
+ more dimensions. It maintains key association when sorting.
+ </para>
+ <para>
+ The input arrays are treated as columns of a table to be sorted
+ by rows - this resembles the functionality of SQL ORDER BY
+ clause. The first array is the primary one to sort by. The rows
+ (values) in that array that compare the same are sorted by the
+ next input array, and so on.
+ </para>
+ <para>
+ The argument structure of this function is a bit unusual, but
+ flexible. The very first argument has to be an
+ array. Subsequently, each argument can be either an array or a
+ sorting flag from the following lists.
+ </para>
+ <para>
+ Sorting order flags:
+ <itemizedlist>
+ <listitem>
+ <simpara>SORT_ASC - sort in ascending order</simpara>
+ </listitem>
+ <listitem>
+ <simpara>SORT_DESC - sort in descending order</simpara>
+ </listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ Sorting type flags:
+ <itemizedlist>
+ <listitem>
+ <simpara>SORT_REGULAR - compare items normally</simpara>
+ </listitem>
+ <listitem>
+ <simpara>SORT_NUMERIC - compare items numerically</simpara>
+ </listitem>
+ <listitem>
+ <simpara>SORT_STRING - compare items as strings</simpara>
+ </listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ No two sorting flags of the same type can be specified after each
+ array. The sortings flags specified after an array argument apply
+ only to that array - they are reset to default SORT_ASC and
+ SORT_REGULAR after before each new array argument.
+ </para>
+ <para>
+ Returns true on success, false on failure.
+ </para>
+ <para>
+ <example>
+ <title>Sorting multiple arrays</title>
+ <programlisting role="php">
+$ar1 = array ("10", 100, 100, "a");
+$ar2 = array (1, 3, "2", 1);
+array_multisort ($ar1, $ar2);
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ In this example, after sorting, the first array will contain 10,
+ "a", 100, 100. The second array will contain 1, 1, 2, "3". The
+ entries in the second array corresponding to the identical
+ entries in the first array (100 and 100) were sorted as well.
+ </para>
+ <para>
+ <example>
+ <title>Sorting multi-dimensional array</title>
+ <programlisting role="php">
+$ar = array (array ("10", 100, 100, "a"), array (1, 3, "2", 1));
+array_multisort ($ar[0], SORT_ASC, SORT_STRING,
+ $ar[1], SORT_NUMERIC, SORT_DESC);
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ In this example, after sorting, the first array will contain 10,
+ 100, 100, "a" (it was sorted as strings in ascending order), and
+ the second one will contain 1, 3, "2", 1 (sorted as numbers, in
+ descending order).
+ </para>
+ </refsect1>
+ </refentry>
+
   <refentry id="function.array-pad">
    <refnamediv>
     <refname>array_pad</refname>
@@ -235,7 +480,7 @@
      </funcprototype>
     </funcsynopsis>
     <para>
- <function>array_pad</function> returns a copy of the
+ <function>Array_pad</function> returns a copy of the
      <parameter>input</parameter> padded to size specified by
      <parameter>pad_size</parameter> with value
      <parameter>pad_value</parameter>. If
@@ -247,7 +492,7 @@
     </para>
     <para>
      <example>
- <title><function>array_pad</function> example</title>
+ <title><function>Array_pad</function> example</title>
       <programlisting role="php">
 $input = array (12, 10, 9);
 
@@ -279,32 +524,28 @@
      </funcprototype>
     </funcsynopsis>
     <para>
- <function>array_pop</function> pops and returns the last value of
+ <function>Array_pop</function> pops and returns the last value of
      the <parameter>array</parameter>, shortening the
      <parameter>array</parameter> by one element.
     </para>
     <para>
      <example>
- <title><function>array_pop</function> example</title>
+ <title><function>Array_pop</function> example</title>
       <programlisting role="php">
 $stack = array ("orange", "apple", "raspberry");
 $fruit = array_pop ($stack);
       </programlisting>
- <para>
- After this, $stack has only 2 elements: "orange" and "apple",
- and $fruit has "raspberry".
- </para>
      </example>
     </para>
     <para>
+ After this, <varname>$stack</varname> has only 2 elements:
+ "orange" and "apple", and <varname>$fruit</varname> has
+ "raspberry".
+ </para>
+ <para>
      See also <function>array_push</function>,
      <function>array_shift</function>, and
      <function>array_unshift</function>.
- <note>
- <para>
- This function was added in PHP 4.0.
- </para>
- </note>
     </para>
    </refsect1>
   </refentry>
@@ -323,14 +564,13 @@
       <funcdef>int <function>array_push</function></funcdef>
       <paramdef>array <parameter>array</parameter></paramdef>
       <paramdef>mixed <parameter>var</parameter></paramdef>
- <paramdef>
+ <paramdef>mixed
        <parameter><optional>...</optional></parameter>
       </paramdef>
      </funcprototype>
     </funcsynopsis>
-
     <para>
- <function>array_push</function> treats
+ <function>Array_push</function> treats
      <parameter>array</parameter> as a stack, and pushes the passed
      variables onto the end of <parameter>array</parameter>. The
      length of <parameter>array</parameter> increases by the number of
@@ -345,28 +585,75 @@
     </para>
     <para>
      <example>
- <title><function>array_push</function> example</title>
+ <title><function>Array_push</function> example</title>
       <programlisting role="php">
 $stack = array (1, 2);
-array_push($stack, "+", 3);
+array_push ($stack, "+", 3);
       </programlisting>
      </example>
- This example would result in $stack having 4 elements: 1, 2, "+",
- and 3.
     </para>
     <para>
+ This example would result in <varname>$stack</varname> having 4
+ elements: 1, 2, "+", and 3.
+ </para>
+ <para>
      See also: <function>array_pop</function>,
      <function>array_shift</function>, and
      <function>array_unshift</function>.
- <note>
- <para>
- This function was added in PHP 4.0.
- </para>
- </note>
     </para>
    </refsect1>
   </refentry>
 
+ <refentry id="function.array-rand">
+ <refnamediv>
+ <refname>array_rand</refname>
+ <refpurpose>
+ Pick one or more random entries out of an array
+ </refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Description</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>mixed <function>array_rand</function></funcdef>
+ <paramdef>array <parameter>input</parameter></paramdef>
+ <paramdef>int
+ <parameter><optional>num_req</optional></parameter>
+ </paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ <function>Array_rand</function> is rather useful when you want to
+ pick one or more random entries out of an array. It takes an
+ <parameter>input</parameter> array and an optional argument
+ <parameter>num_req</parameter> which specifies how many entries you
+ want to pick - if not specified, it defaults to 1.
+ </para>
+ <para>
+ If you are picking only one entry, <function>array_rand</function>
+ returns the key for a random entry. Otherwise, it returns an array
+ of keys for the random entries. This is done so that you can pick
+ random keys as well as values out of the array.
+ </para>
+ <para>
+ Don't forget to call <function>srand</function> to seed the random
+ number generator.
+ </para>
+ <para>
+ <example>
+ <title><function>Array_rand</function> example</title>
+ <programlisting role="php">
+srand ((double) microtime() * 10000000);
+$input = array ("Neo", "Morpheus", "Trinity", "Cypher", "Tank");
+$rand_keys = array_rand ($input, 2);
+print $input[$rand_keys[0]]."\n";
+print $input[$rand_keys[1]]."\n";
+ </programlisting>
+ </example>
+ </para>
+ </refsect1>
+ </refentry>
+
   <refentry id="function.array-reverse">
    <refnamediv>
     <refname>array_reverse</refname>
@@ -383,25 +670,23 @@
      </funcprototype>
     </funcsynopsis>
     <para>
- <function>array_reverse</function> takes input
+ <function>Array_reverse</function> takes input
      <parameter>array</parameter> and returns a new array with the
      order of the elements reversed.
     </para>
     <para>
      <example>
- <title><function>array_reverse</function> example</title>
+ <title><function>Array_reverse</function> example</title>
       <programlisting role="php">
 $input = array ("php", 4.0, array ("green", "red"));
 $result = array_reverse ($input);
       </programlisting>
      </example>
- This makes $result have array (array ("green", "red"), 4.0, "php").
- <note>
- <para>
- This function was added in PHP 4.0 Beta 3.
- </para>
- </note>
     </para>
+ <para>
+ This makes <varname>$result</varname> have <literal>array
+ (array ("green", "red"), 4.0, "php")</literal>.
+ </para>
    </refsect1>
   </refentry>
 
@@ -421,31 +706,28 @@
      </funcprototype>
     </funcsynopsis>
     <para>
- <function>array_shift</function> shifts the first value of the
+ <function>Array_shift</function> shifts the first value of the
      <parameter>array</parameter> off and returns it, shortening the
      <parameter>array</parameter> by one element and moving everything
      down.
     </para>
     <para>
      <example>
- <title><function>array_shift</function> example</title>
+ <title><function>Array_shift</function> example</title>
       <programlisting role="php">
 $args = array ("-v", "-f");
 $opt = array_shift ($args);
       </programlisting>
      </example>
- This would result in $args having one element "-f" left, and $opt
- being "-v".
+ </para>
+ <para>
+ This would result in <varname>$args</varname> having one element
+ "-f" left, and <varname>$opt</varname> being "-v".
     </para>
     <para>
      See also <function>array_unshift</function>,
      <function>array_push</function>, and
      <function>array_pop</function>.
- <note>
- <para>
- This function was added in PHP 4.0.
- </para>
- </note>
     </para>
    </refsect1>
   </refentry>
@@ -470,7 +752,7 @@
      </funcprototype>
     </funcsynopsis>
     <para>
- <function>array_slice</function> returns a sequence of elements
+ <function>Array_slice</function> returns a sequence of elements
      from the <parameter>array</parameter> specified by the
      <parameter>offset</parameter> and <parameter>length</parameter>
      parameters.
@@ -492,7 +774,7 @@
     </para>
     <para>
      <example>
- <title><function>array_slice</function> examples</title>
+ <title><function>Array_slice</function> examples</title>
       <programlisting role="php">
 $input = array ("a", "b", "c", "d", "e");
 
@@ -505,11 +787,6 @@
     </para>
     <para>
      See also <function>array_splice</function>.
- <note>
- <para>
- This function was added in PHP 4.0.
- </para>
- </note>
     </para>
    </refsect1>
   </refentry>
@@ -540,7 +817,7 @@
      </funcprototype>
     </funcsynopsis>
     <para>
- <function>array_splice</function> removes the elements designated
+ <function>Array_splice</function> removes the elements designated
      by <parameter>offset</parameter> and
      <parameter>length</parameter> from the
      <parameter>input</parameter> array, and replaces them with the
@@ -580,12 +857,13 @@
     </para>
     <para>
      The following equivalences hold:
- <programlisting role="php">
-array_push($input, $x, $y) array_splice($input, count($input), 0, array($x, $y))
-array_pop($input) array_splice($input, -1)
-array_shift($input) array_splice($input, 0, 1)
-array_unshift($input, $x, $y) array_splice($input, 0, 0, array($x, $y))
-$a[$x] = $y array_splice($input, $x, 1, $y)
+ <programlisting>
+array_push ($input, $x, $y) array_splice ($input, count ($input), 0,
+ array ($x, $y))
+array_pop ($input) array_splice ($input, -1)
+array_shift ($input) array_splice ($input, 0, 1)
+array_unshift ($input, $x, $y) array_splice ($input, 0, 0, array ($x, $y))
+$a[$x] = $y array_splice ($input, $x, 1, $y)
      </programlisting>
     </para>
     <para>
@@ -593,36 +871,67 @@
     </para>
     <para>
      <example>
- <title><function>array_splice</function> examples</title>
+ <title><function>Array_splice</function> examples</title>
       <programlisting role="php">
-$input = array("red", "green", "blue", "yellow");
+$input = array ("red", "green", "blue", "yellow");
 
-array_splice($input, 2); // $input is now array("red", "green")
-array_splice($input, 1, -1); // $input is now array("red", "yellow")
-array_splice($input, 1, count($input), "orange");
- // $input is now array("red", "orange")
-array_splice($input, -1, 1, array("black", "maroon"));
- // $input is now array("red", "green",
- // "blue", "black", "maroon")
+array_splice ($input, 2); // $input is now array ("red", "green")
+array_splice ($input, 1, -1); // $input is now array ("red", "yellow")
+array_splice ($input, 1, count($input), "orange");
+ // $input is now array ("red", "orange")
+array_splice ($input, -1, 1, array("black", "maroon"));
+ // $input is now array ("red", "green",
+ // "blue", "black", "maroon")
       </programlisting>
      </example>
     </para>
     <para>
      See also <function>array_slice</function>.
- <note>
- <para>
- This function was added in PHP 4.0.
- </para>
- </note>
     </para>
    </refsect1>
   </refentry>
 
+ <refentry id="function.array-unique">
+ <refnamediv>
+ <refname>array_unique</refname>
+ <refpurpose>Removes duplicate values from an array</refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Description</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>array <function>array_unique</function></funcdef>
+ <paramdef>array <parameter>array</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ <function>Array_unique</function> takes input
+ <parameter>array</parameter> and returns a new array
+ without duplicate values.
+ Note that keys are preserved.
+ </para>
+ <para>
+ <example>
+ <title><function>Array_unique</function> example</title>
+ <programlisting role="php">
+$input = array ("a" => "green", "red", "b" => "green", "blue", "red");
+$result = array_unique ($input);
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ This makes <varname>$result</varname> have <literal>array ("a" =>
+ "green", "red", "blue");</literal>
+ </para>
+ </refsect1>
+ </refentry>
+
   <refentry id="function.array-unshift">
    <refnamediv>
     <refname>array_unshift</refname>
- <refpurpose>Push one or more elements
- onto the beginning of array</refpurpose>
+ <refpurpose>
+ Push one or more elements onto the beginning of array
+ </refpurpose>
    </refnamediv>
    <refsect1>
     <title>Description</title>
@@ -631,7 +940,7 @@
       <funcdef>int <function>array_unshift</function></funcdef>
       <paramdef>array <parameter>array</parameter></paramdef>
       <paramdef>mixed <parameter>var</parameter></paramdef>
- <paramdef>
+ <paramdef>mixed
        <parameter>
         <optional>...</optional>
        </parameter>
@@ -639,7 +948,7 @@
      </funcprototype>
     </funcsynopsis>
     <para>
- <function>array_unshift</function> prepends passed elements to
+ <function>Array_unshift</function> prepends passed elements to
      the front of the <parameter>array</parameter>. Note that the list
      of elements is prepended as a whole, so that the prepended
      elements stay in the same order.
@@ -650,24 +959,21 @@
     </para>
     <para>
      <example>
- <title><function>array_unshift</function> example</title>
+ <title><function>Array_unshift</function> example</title>
       <programlisting role="php">
-$queue = array("p1", "p3");
-array_unshift($queue, "p4", "p5", "p6");
+$queue = array ("p1", "p3");
+array_unshift ($queue, "p4", "p5", "p6");
       </programlisting>
      </example>
- This would result in $queue having 5 elements: "p4", "p5", "p6",
- "p1", and "p3".
+ </para>
+ <para>
+ This would result in <varname>$queue</varname> having 5
+ elements: "p4", "p5", "p6", "p1", and "p3".
     </para>
     <para>
      See also <function>array_shift</function>,
      <function>array_push</function>, and
      <function>array_pop</function>.
- <note>
- <para>
- This function was added in PHP 4.0.
- </para>
- </note>
     </para>
    </refsect1>
   </refentry>
@@ -686,22 +992,17 @@
      </funcprototype>
     </funcsynopsis>
     <para>
- <function>array_values</function> returns all the values from the
+ <function>Array_values</function> returns all the values from the
      <parameter>input</parameter> array.
     </para>
     <para>
      <example>
- <title><function>array_values</function> example</title>
+ <title><function>Array_values</function> example</title>
       <programlisting role="php">
-$array = array("size" => "XL", "color" => "gold");
-array_values($array); // returns array("XL", "gold")
+$array = array ("size" => "XL", "color" => "gold");
+array_values ($array); // returns array ("XL", "gold")
       </programlisting>
      </example>
- <note>
- <para>
- This function was added in PHP 4.0.
- </para>
- </note>
     </para>
    </refsect1>
   </refentry>
@@ -710,7 +1011,7 @@
    <refnamediv>
     <refname>array_walk</refname>
     <refpurpose>
- Apply a user function to every member of an array.
+ Apply a user function to every member of an array
     </refpurpose>
    </refnamediv>
    <refsect1>
@@ -762,11 +1063,11 @@
     </note>
     <para>
      <example>
- <title><function>array_walk</function> example</title>
+ <title><function>Array_walk</function> example</title>
       <programlisting role="php">
 $fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
 
-function test_alter (&$item1, $key, $prefix) {
+function test_alter (&amp;$item1, $key, $prefix) {
    $item1 = "$prefix: $item1";
 }
 
@@ -801,6 +1102,9 @@
      <funcprototype>
       <funcdef>void <function>arsort</function></funcdef>
       <paramdef>array <parameter>array</parameter></paramdef>
+ <paramdef>int
+ <parameter><optional>sort_flags</optional></parameter>
+ </paramdef>
      </funcprototype>
     </funcsynopsis>
     <para>
@@ -809,27 +1113,40 @@
      with. This is used mainly when sorting associative arrays where
      the actual element order is significant.
      <example>
- <title><function>arsort</function> example</title>
+ <title><function>Arsort</function> example</title>
       <programlisting role="php">
 $fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
 arsort ($fruits);
-reset($fruits);
-while(list($key,$val)=each($fruits)) {
- echo "$key = $val\n";
+reset ($fruits);
+while (list ($key, $val) = each ($fruits)) {
+ echo "$key = $val\n";
 }
       </programlisting>
      </example>
+ </para>
+ <para>
      This example would display:
- <computeroutput>
+ </para>
+ <para>
+ <informalexample>
+ <programlisting>
 fruits[a] = orange
 fruits[d] = lemon
 fruits[b] = banana
 fruits[c] = apple
- </computeroutput>
+ </programlisting>
+ </informalexample>
+ </para>
+ <para>
      The fruits have been sorted in reverse alphabetical order, and
      the index associated with each element has been maintained.
     </para>
     <para>
+ You may modify the behavior of the sort using the optional
+ parameter <parameter>sort_flags</parameter>, for details
+ see <function>sort</function>.
+ </para>
+ <para>
      See also: <function>asort</function>, <function>rsort</function>,
      <function>ksort</function>, and <function>sort</function>.
     </para>
@@ -847,6 +1164,7 @@
      <funcprototype>
       <funcdef>void <function>asort</function></funcdef>
       <paramdef>array <parameter>array</parameter></paramdef>
+ <paramdef>int <parameter><optional>sort_flags</optional></parameter></paramdef>
      </funcprototype>
     </funcsynopsis>
     <para>
@@ -855,27 +1173,40 @@
      with. This is used mainly when sorting associative arrays where
      the actual element order is significant.
      <example>
- <title><function>asort</function> example</title>
+ <title><function>Asort</function> example</title>
       <programlisting role="php">
 $fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
 asort ($fruits);
-reset($fruits);
-while(list($key,$val)=each($fruits)) {
- echo "$key = $val\n";
+reset ($fruits);
+while (list ($key, $val) = each ($fruits)) {
+ echo "$key = $val\n";
 }
       </programlisting>
      </example>
+ </para>
+ <para>
      This example would display:
- <computeroutput>
+ </para>
+ <para>
+ <informalexample>
+ <programlisting>
 fruits[c] = apple
 fruits[b] = banana
 fruits[d] = lemon
 fruits[a] = orange
- </computeroutput>
+ </programlisting>
+ </informalexample>
+ </para>
+ <para>
      The fruits have been sorted in alphabetical order, and the index
      associated with each element has been maintained.
     </para>
     <para>
+ You may modify the behavior of the sort using the optional
+ parameter <parameter>sort_flags</parameter>, for details
+ see <function>sort</function>.
+ </para>
+ <para>
      See also <function>arsort</function>, <function>rsort</function>,
      <function>ksort</function>, and <function>sort</function>.
     </para>
@@ -894,16 +1225,14 @@
     <funcsynopsis>
      <funcprototype>
       <funcdef>array <function>compact</function></funcdef>
- <paramdef><parameter>string varname | array
- varnames</parameter></paramdef>
- <paramdef>
+ <paramdef>mixed <parameter>varname</parameter></paramdef>
+ <paramdef>mixed
        <parameter><optional>...</optional></parameter>
       </paramdef>
      </funcprototype>
     </funcsynopsis>
-
     <para>
- <function>compact</function> takes a variable number of
+ <function>Compact</function> takes a variable number of
      parameters. Each parameter can be either a string containing the
      name of the variable, or an array of variable names. The array
      can contain other arrays of variable names inside it;
@@ -919,7 +1248,7 @@
     </para>
     <para>
      <example>
- <title><function>compact</function> example</title>
+ <title><function>Compact</function> example</title>
       <programlisting role="php">
 $city = "San Francisco";
 $state = "CA";
@@ -930,18 +1259,13 @@
 $result = compact ("event", $location_vars);
       </programlisting>
       <para>
- After this, $result will be array ("event" => "SIGGRAPH",
- "city" => "San Francisco", "state" => "CA").
+ After this, <varname>$result</varname> will be <literal>array ("event"
+ => "SIGGRAPH", "city" => "San Francisco", "state" => "CA")</literal>.
       </para>
      </example>
     </para>
     <para>
      See also <function>extract</function>.
- <note>
- <para>
- This function was added in PHP 4.0.
- </para>
- </note>
     </para>
    </refsect1>
   </refentry>
@@ -949,7 +1273,7 @@
   <refentry id="function.count">
    <refnamediv>
     <refname>count</refname>
- <refpurpose>count elements in a variable</refpurpose>
+ <refpurpose>Count elements in a variable</refpurpose>
    </refnamediv>
    <refsect1>
     <title>Description</title>
@@ -971,7 +1295,7 @@
      Returns 0 if the variable is not set.
      <warning>
       <para>
- <function>count</function> may return 0 for a variable that
+ <function>Count</function> may return 0 for a variable that
        isn't set, but it may also return 0 for a variable that has
        been initialized with an empty array. Use
        <function>isset</function> to test if a variable is set.
@@ -1010,7 +1334,6 @@
      pointer. It does not move the pointer in any way. If the
      internal pointer points beyond the end of the elements list,
      <function>current</function> returns false.
-
      <warning>
       <para>
        If the array contains empty elements (0 or "", the empty
@@ -1025,7 +1348,7 @@
     </para>
     <para>
      See also: <function>end</function>, <function>next</function>,
- <function>prev</function> and <function>reset</function>.
+ <function>prev</function>, and <function>reset</function>.
     </para>
    </refsect1>
   </refentry>
@@ -1062,13 +1385,13 @@
     </para>
     <para>
      <example>
- <title><function>each</function> examples</title>
+ <title><function>Each</function> examples</title>
       <programlisting role="php">
 $foo = array ("bob", "fred", "jussi", "jouni", "egon", "marliese");
 $bar = each ($foo);
       </programlisting>
       <para>
- <literal>$bar</literal> now contains the following key/value
+ <varname>$bar</varname> now contains the following key/value
        pairs:
        <itemizedlist spacing="compact">
         <listitem><simpara>0 => 0</simpara></listitem>
@@ -1076,14 +1399,13 @@
         <listitem><simpara>key => 0</simpara></listitem>
         <listitem><simpara>value => 'bob'</simpara></listitem>
        </itemizedlist>
-
        <programlisting role="php">
 $foo = array ("Robert" => "Bob", "Seppo" => "Sepi");
 $bar = each ($foo);
        </programlisting>
       </para>
       <para>
- <literal>$bar</literal> now contains the following key/value
+ <varname>$bar</varname> now contains the following key/value
        pairs:
        <itemizedlist spacing="compact">
         <listitem><simpara>0 => 'Robert'</simpara></listitem>
@@ -1094,14 +1416,14 @@
       </para>
      </example>
     </para>
-
     <para>
- <function>each</function> is typically used in conjunction with
+ <function>Each</function> is typically used in conjunction with
      <function>list</function> to traverse an array; for instance,
- $HTTP_POST_VARS:
+ <varname>$HTTP_POST_VARS</varname>:
      <example>
       <title>
- Traversing $HTTP_POST_VARS with <function>each</function>
+ Traversing <varname>$HTTP_POST_VARS</varname> with
+ <function>each</function>
       </title>
       <programlisting role="php">
 echo "Values submitted via POST method:&lt;br&gt;";
@@ -1112,7 +1434,6 @@
       </programlisting>
      </example>
     </para>
-
     <para>
      After <function>each</function> has executed, the array cursor
      will be left on the next element of the array, or on the last
@@ -1142,7 +1463,7 @@
      </funcprototype>
     </funcsynopsis>
     <para>
- <function>end</function> advances <parameter>array</parameter>'s
+ <function>End</function> advances <parameter>array</parameter>'s
      internal pointer to the last element.
     </para>
     <para>
@@ -1184,7 +1505,7 @@
      <parameter>prefix</parameter> parameters.
     </para>
     <para>
- <function>extract</function> checks for colissions with existing
+ <function>Extract</function> checks for colissions with existing
      variables. The way collisions are treated is determined by
      <parameter>extract_type</parameter>. It can be one of the
      following values:
@@ -1234,7 +1555,7 @@
      EXTR_PREFIX_ALL.
     </para>
     <para>
- <function>extract</function> checks each key to see if it
+ <function>Extract</function> checks each key to see if it
      constitues a valid variable name, and if it does only then does
      it proceed to import it.
     </para>
@@ -1271,12 +1592,15 @@
      </programlisting>
     </para>
     <para>
- The $size wasn't overwritten, becaus we specified
- EXTR_PREFIX_SAME, which resulted in $wddx_size being created.
- If EXTR_SKIP was specified, then $wddx_size wouldn't even have
- been created. EXTR_OVERWRITE would have cause $size to have
- value "medium", and EXTR_PREFIX_ALL would result in new
- variables being named $wddx_color, $wddx_size, and $wddx_shape.
+ The <varname>$size</varname> wasn't overwritten, becaus we
+ specified EXTR_PREFIX_SAME, which resulted in
+ <varname>$wddx_size</varname> being created. If EXTR_SKIP was
+ specified, then $wddx_size wouldn't even have been created.
+ EXTR_OVERWRITE would have cause <varname>$size</varname> to have
+ value "medium", and EXTR_PREFIX_ALL would result in new variables
+ being named <varname>$wddx_color</varname>,
+ <varname>$wddx_size</varname>, and
+ <varname>$wddx_shape</varname>.
     </para>
    </refsect1>
   </refentry>
@@ -1302,18 +1626,13 @@
     </para>
     <para>
      <example>
- <title><function>in_array</function> example</title>
+ <title><function>In_array</function> example</title>
       <programlisting role="php">
 $os = array ("Mac", "NT", "Irix", "Linux");
 if (in_array ("Irix", $os))
     print "Got Irix";
       </programlisting>
      </example>
- <note>
- <para>
- This function was added in PHP 4.0.
- </para>
- </note>
     </para>
    </refsect1>
   </refentry>
@@ -1332,11 +1651,11 @@
      </funcprototype>
     </funcsynopsis>
     <para>
- <function>key</function> returns the index element of the
+ <function>Key</function> returns the index element of the
      current array position.
     </para>
     <para>
- See also: <function>current</function>, <function>next</function>
+ See also <function>current</function> and <function>next</function>.
     </para>
    </refsect1>
   </refentry>
@@ -1352,34 +1671,48 @@
      <funcprototype>
       <funcdef>int <function>krsort</function></funcdef>
       <paramdef>array <parameter>array</parameter></paramdef>
+ <paramdef>int
+ <parameter><optional>sort_flags</optional></parameter>
+ </paramdef>
      </funcprototype>
     </funcsynopsis>
     <para>
      Sorts an array by key in reverse order, maintaining key to data
      correlations. This is useful mainly for associative arrays.
      <example>
- <title><function>krsort</function> example</title>
+ <title><function>Krsort</function> example</title>
       <programlisting role="php">
 $fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
 krsort ($fruits);
-reset($fruits);
-while(list($key,$val)=each($fruits)) {
- echo "$key -> $val\n";
+reset ($fruits);
+while (list ($key, $val) = each ($fruits)) {
+ echo "$key -> $val\n";
 }
       </programlisting>
      </example>
+ </para>
+ <para>
      This example would display:
- <computeroutput>
+ </para>
+ <para>
+ <informalexample>
+ <programlisting>
 fruits[d] = lemon
 fruits[c] = apple
 fruits[b] = banana
 fruits[a] = orange
- </computeroutput>
+ </programlisting>
+ </informalexample>
     </para>
+ <para>
+ You may modify the behavior of the sort using the optional
+ parameter <parameter>sort_flags</parameter>, for details
+ see <function>sort</function>.
+ </para>
     <simpara>
      See also <function>asort</function>, <function>arsort</function>,
- <function>ksort</function> <function>sort</function>, and
- <function>rsort</function>.
+ <function>ksort</function> <function>sort</function>,
+ <function>natsort</function>and <function>rsort</function>.
     </simpara>
    </refsect1>
   </refentry>
@@ -1395,33 +1728,48 @@
      <funcprototype>
       <funcdef>int <function>ksort</function></funcdef>
       <paramdef>array <parameter>array</parameter></paramdef>
+ <paramdef>int
+ <parameter><optional>sort_flags</optional></parameter>
+ </paramdef>
      </funcprototype>
     </funcsynopsis>
     <para>
      Sorts an array by key, maintaining key to data correlations. This
      is useful mainly for associative arrays.
      <example>
- <title><function>ksort</function> example</title>
+ <title><function>Ksort</function> example</title>
       <programlisting role="php">
 $fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
 ksort ($fruits);
-reset($fruits);
-while(list($key,$val)=each($fruits)) {
- echo "$key -> $val\n";
+reset ($fruits);
+while (list ($key, $val) = each ($fruits)) {
+ echo "$key -> $val\n";
 }
       </programlisting>
      </example>
+ </para>
+ <para>
      This example would display:
- <computeroutput>
+ </para>
+ <para>
+ <informalexample>
+ <programlisting>
 fruits[a] = orange
 fruits[b] = banana
 fruits[c] = apple
 fruits[d] = lemon
- </computeroutput>
+ </programlisting>
+ </informalexample>
     </para>
+ <para>
+ You may modify the behavior of the sort using the optional
+ parameter <parameter>sort_flags</parameter>, for details
+ see <function>sort</function>.
+ </para>
     <simpara>
      See also <function>asort</function>, <function>arsort</function>,
- <function>sort</function>, and <function>rsort</function>.
+ <function>sort</function>, <function>natsort</function>, and
+ <function>rsort</function>.
     </simpara>
    </refsect1>
   </refentry>
@@ -1446,7 +1794,7 @@
      but a language construct. <function>list</function> is used to
      assign a list of variables in one operation.
      <example>
- <title><function>list</function> example</title>
+ <title><function>List</function> example</title>
       <programlisting role="php">
 &lt;table>
  &lt;tr>
@@ -1456,12 +1804,12 @@
 
 &lt;?php
 
-$result = mysql($conn, "SELECT id, name, salary FROM employees");
-while (list($id, $name, $salary) = mysql_fetch_row($result)) {
- print(" &lt;tr>\n".
- " &lt;td>&lt;a href=\"info.php3?id=$id\">$name&lt;/a>&lt;/td>\n".
- " &lt;td>$salary&lt;/td>\n".
- " &lt;/tr>\n");
+$result = mysql ($conn, "SELECT id, name, salary FROM employees");
+while (list ($id, $name, $salary) = mysql_fetch_row ($result)) {
+ print (" &lt;tr>\n".
+ " &lt;td>&lt;a href=\"info.php3?id=$id\">$name&lt;/a>&lt;/td>\n".
+ " &lt;td>$salary&lt;/td>\n".
+ " &lt;/tr>\n");
 }
 
 ?>
@@ -1470,12 +1818,127 @@
       </programlisting>
      </example>
     </para>
+ <para>
+ See also <function>each</function> and <function>array</function>.
+ </para>
+ </refsect1>
+ </refentry>
+
+ <refentry id="function.natsort">
+ <refnamediv>
+ <refname>natsort</refname>
+ <refpurpose>
+ Sort an array using a "natural order" algorithm
+ </refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Description</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>void <function>natsort</function></funcdef>
+ <paramdef>array <parameter>array</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ This function implements a sort algorithm that orders
+ alphanumeric strings in the way a human being would. This is
+ described as a "natural ordering". An example of the difference
+ between this algorithm and the regular computer string sorting
+ algorithms (used in <function>sort</function>) can be seen below:
+ </para>
+ <para>
+ <example>
+ <title><function>natsort</function> example</title>
+ <programlisting role="php">
+$array1 = $array2 = array ("img12.png","img10.png","img2.png","img1.png");
+
+sort($array1);
+echo "Standard sorting\n";
+print_r($array1);
+
+natsort($array2);
+echo "\nNatural order sorting\n";
+print_r($array2);
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ The code above will generate the following output:
+ </para>
+ <para>
+ <informalexample>
+ <programlisting>
+Standard sorting
+Array
+(
+ [0] => img1.png
+ [1] => img10.png
+ [2] => img12.png
+ [3] => img2.png
+)
+
+Natural order sorting
+Array
+(
+ [3] => img1.png
+ [2] => img2.png
+ [1] => img10.png
+ [0] => img12.png
+)
+ </programlisting>
+ </informalexample>
+ For more infomation see: Martin Pool's <ulink
+ url="&url.strnatcmp;">Natural Order String Comparison</ulink>
+ page.
+ </para>
     <para>
- See also: <function>each</function>, <function>array</function>.
+ See also <function>natcasesort</function>,
+ <function>strnatcmp</function> and
+ <function>strnatcasecmp</function>.
     </para>
    </refsect1>
   </refentry>
 
+ <refentry id="function.natcasesort">
+ <refnamediv>
+ <refname>natcasesort</refname>
+ <refpurpose>
+ Sort an array using a case insensitive "natural order" algorithm
+ </refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Description</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>void <function>natcasesort</function></funcdef>
+ <paramdef>array <parameter>array</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ This function implements a sort algorithm that orders
+ alphanumeric strings in the way a human being would. This is
+ described as a "natural ordering".
+ </para>
+ <para>
+ <function>natcasesort</function> is a case insensitive version of
+ <function>natsort</function>. See <function>natsort</function>
+ for an example of the difference between this algorithm and the
+ regular computer string sorting algorithms.
+ </para>
+ <para>
+ For more infomation see: Martin Pool's <ulink
+ url="&url.strnatcmp;">Natural Order String Comparison</ulink>
+ page.
+ </para>
+ <para>
+ See also <function>sort</function>,
+ <function>natsort</function>,
+ <function>strnatcmp</function> and
+ <function>strnatcasecmp</function>.
+ </para>
+ </refsect1>
+ </refentry>
+
   <refentry id="function.next">
    <refnamediv>
     <refname>next</refname>
@@ -1496,7 +1959,7 @@
      internal array pointer, or false if there are no more elements.
     </para>
     <para>
- <function>next</function> behaves like
+ <function>Next</function> behaves like
      <function>current</function>, with one difference. It advances
      the internal array pointer one place forward before returning the
      element. That means it returns the next array element and
@@ -1505,17 +1968,18 @@
      element list, <function>next</function> returns false.
      <warning>
       <para>
- If the array contains empty elements then this function will
- return false for these elements as well. To properly traverse
- an array which may contain empty elements see the
+ If the array contains empty elements, or elements that have a key
+ value of 0 then this function will return false for these elements
+ as well. To properly traverse an array which may contain empty
+ elements or elements with key values of 0 see the
        <function>each</function> function.
       </para>
      </warning>
     </para>
     <para>
      See also:
- <function>current</function>, <function>end</function>
- <function>prev</function> and <function>reset</function>
+ <function>current</function>, <function>end</function>,
+ <function>prev</function>, and <function>reset</function>.
     </para>
    </refsect1>
   </refentry>
@@ -1571,13 +2035,13 @@
      </warning>
     </para>
     <para>
- <function>prev</function> behaves just like
+ <function>Prev</function> behaves just like
      <function>next</function>, except it rewinds the internal array
      pointer one place instead of advancing it.
     </para>
     <para>
- See also: <function>current</function>, <function>end</function>
- <function>next</function> and <function>reset</function>
+ See also: <function>current</function>, <function>end</function>,
+ <function>next</function>, and <function>reset</function>.
     </para>
    </refsect1>
   </refentry>
@@ -1599,7 +2063,7 @@
      </funcprototype>
     </funcsynopsis>
     <para>
- <function>range</function> returns an array of integers from
+ <function>Range</function> returns an array of integers from
      <parameter>low</parameter> to <parameter>high</parameter>,
      inclusive.
     </para>
@@ -1625,17 +2089,17 @@
      </funcprototype>
     </funcsynopsis>
     <para>
- <function>reset</function> rewinds <parameter>array</parameter>'s
+ <function>Reset</function> rewinds <parameter>array</parameter>'s
      internal pointer to the first element.
     </para>
     <para>
- <function>reset</function> returns the value of the first array
+ <function>Reset</function> returns the value of the first array
      element.
     </para>
     <para>
      See also: <function>current</function>,
      <function>each</function>, <function>next</function>,
- <function>prev</function>, and <function>reset</function>.
+ and <function>prev</function>.
     </para>
    </refsect1>
   </refentry>
@@ -1651,31 +2115,47 @@
      <funcprototype>
       <funcdef>void <function>rsort</function></funcdef>
       <paramdef>array <parameter>array</parameter></paramdef>
+ <paramdef>int
+ <parameter><optional>sort_flags</optional></parameter>
+ </paramdef>
      </funcprototype>
     </funcsynopsis>
     <para>
      This function sorts an array in reverse order (highest to lowest).
      <example>
- <title><function>rsort</function> example</title>
- <programlisting role="php">
+ <title><function>Rsort</function> example</title>
+ <programlisting role="php">
 $fruits = array ("lemon", "orange", "banana", "apple");
 rsort ($fruits);
-reset($fruits);
-while(list($key,$val)=each($fruits)) {
- echo "$key -> $val\n";
+reset ($fruits);
+while (list ($key, $val) = each ($fruits)) {
+ echo "$key -> $val\n";
 }
       </programlisting>
      </example>
+ </para>
+ <para>
      This example would display:
- <computeroutput>
+ </para>
+ <para>
+ <informalexample>
+ <programlisting>
 fruits[0] = orange
 fruits[1] = lemon
 fruits[2] = banana
 fruits[3] = apple
- </computeroutput>
+ </programlisting>
+ </informalexample>
+ </para>
+ <para>
      The fruits have been sorted in reverse alphabetical order.
     </para>
     <para>
+ You may modify the behavior of the sort using the optional
+ parameter <parameter>sort_flags</parameter>, for details
+ see <function>sort</function>.
+ </para>
+ <para>
      See also: <function>arsort</function>,
      <function>asort</function>, <function>ksort</function>,
      <function>sort</function>, and <function>usort</function>.
@@ -