pgerzson Fri Jan 4 09:34:02 2002 EDT
Modified files:
/phpdoc/en/functions array.xml
Log:
correct "See also" cross references and exampe outputs for several functions
and array_unique note on preserving keys
Index: phpdoc/en/functions/array.xml
diff -u phpdoc/en/functions/array.xml:1.147 phpdoc/en/functions/array.xml:1.148
--- phpdoc/en/functions/array.xml:1.147 Sun Dec 30 10:38:34 2001
+++ phpdoc/en/functions/array.xml Fri Jan 4 09:34:01 2002
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.147 $ -->
+<!-- $Revision: 1.148 $ -->
<reference id="ref.array">
<title>Array Functions</title>
<titleabbrev>Arrays</titleabbrev>
@@ -140,7 +140,7 @@
</para>
<para>
See also <function>array_pad</function>,
- <function>list</function>, and <function>range</function>.
+ <function>list</function> and<function>range</function>.
</para>
</refsect1>
</refentry>
@@ -308,9 +308,22 @@
<programlisting role="php">
<![CDATA[
$array = array (1, "hello", 1, "world", "hello");
-array_count_values ($array); // returns array (1=>2, "hello"=>2, "world"=>1)
+print_r(array_count_values ($array));
]]>
</programlisting>
+ <para>
+ The printout of the above program will be:
+ <screen>
+<![CDATA[
+Array
+(
+ [1] => 2
+ [hello] => 2
+ [world] => 1
+)
+]]>
+ </screen>
+ </para>
</example>
</para>
</refsect1>
@@ -417,18 +430,36 @@
$array1 = array ("a"=>1, "b"=>2, "c"=>3, "d"=>4, "e"=>5);
$array2 = array (6, 7, 8, 9, 10, 11, 12);
-$odd_arr = array_filter($array1, "odd");
-$even_arr = array_filter($array2, "even");
+echo "Odd :\n";
+print_r(array_filter($array1, "odd"));
+echo "Even:\n";
+print_r(array_filter($array2, "even"));
]]>
</programlisting>
+ <para>
+ The printout of the program above will be:
+ <screen role="php">
+<![CDATA[
+Odd :
+Array
+(
+ [a] => 1
+ [c] => 3
+ [e] => 5
+)
+Even:
+Array
+(
+ [0] => 6
+ [2] => 8
+ [4] => 10
+ [6] => 12
+)
+]]>
+ </screen>
+ </para>
</example>
</para>
- <para>
- This makes <varname>$odd_arr</varname> have
- <literal>array ("a"=>1, "c"=>3, "e"=>5);</literal>,
- and <varname>$even_arr</varname> have
- <literal>array (6, 8, 10, 12);</literal>,
- </para>
¬e.func-callback;
<para>
See also <function>array_map</function>, and
@@ -488,9 +519,21 @@
<![CDATA[
$trans = array ("a" => 1, "b" => 1, "c" => 2);
$trans = array_flip ($trans);
-// now $trans is : array(1 => "b", 2 => "c");
+print_r($trans);
]]>
</programlisting>
+ <para>
+ now $trans is :
+ <screen>
+<![CDATA[
+Array
+(
+ [1] => b
+ [2] => c
+)
+]]>
+ </screen>
+ </para>
</example>
</para>
</refsect1>
@@ -523,19 +566,24 @@
<programlisting role="php">
<![CDATA[
$a = array_fill(5, 6, 'banana');
-
-/*
-$a now has the following entries:
-
-$a[5] = "banana";
-$a[6] = "banana";
-$a[7] = "banana";
-$a[8] = "banana";
-$a[9] = "banana";
-$a[10] = "banana";
-*/
]]>
</programlisting>
+ <para>
+ $a now has the following entries using <function>print_r</function>:
+ <screen>
+<![CDATA[
+Array
+(
+ [5] => banana
+ [6] => banana
+ [7] => banana
+ [8] => banana
+ [9] => banana
+ [10] => banana
+)
+]]>
+ </screen>
+ </para>
</example>
</para>
</refsect1>
@@ -574,12 +622,20 @@
$result = array_intersect ($array1, $array2);
]]>
</programlisting>
+ <para>
+ This makes <varname>$result</varname> have
+ <screen role="php">
+<![CDATA[
+Array
+(
+ [a] => green
+ [0] => red
+)
+]]>
+ </screen>
+ </para>
</example>
</para>
- <para>
- This makes <varname>$result</varname> have <literal>array ("a"
- => "green", "red");</literal>
- </para>
<note>
<simpara>
Two elements are considered equal if and only if
@@ -678,15 +734,38 @@
<programlisting role="php">
<![CDATA[
$array = array (0 => 100, "color" => "red");
-array_keys ($array); // returns array (0, "color")
+print_r(array_keys ($array));
$array = array ("blue", "red", "green", "blue", "blue");
-array_keys ($array, "blue"); // returns array (0, 3, 4)
+print_r(array_keys ($array, "blue"));
$array = array ("color" => array("blue", "red", "green"), "size" => array("small",
"medium", "large"));
-array_keys ($array); // returns array ("color", "size")
+print_r(array_keys ($array));
]]>
</programlisting>
+ <para>
+ The printout of the program above will be:
+ <screen>
+<![CDATA[
+Array
+(
+ [0] => 0
+ [1] => color
+)
+Array
+(
+ [0] => 0
+ [1] => 3
+ [2] => 4
+)
+Array
+(
+ [0] => color
+ [1] => size
+)
+]]>
+ </screen>
+ </para>
</example>
</para>
<note>
@@ -758,15 +837,27 @@
$a = array(1, 2, 3, 4, 5);
$b = array_map("cube", $a);
+print_r($b);
]]>
</programlisting>
+ <para>
+ This makes <varname>$b</varname> have:
+ <screen>
+<![CDATA[
+Array
+(
+ [0] => 1
+ [1] => 8
+ [2] => 27
+ [3] => 64
+ [4] => 125
+)
+]]>
+ </screen>
+ </para>
</example>
</para>
<para>
- This will result in <varname>$b</varname> containing
- <literal>array (1, 8, 27, 64, 125);</literal>
- </para>
- <para>
<example>
<title><function>array_map</function> - using more arrays</title>
<programlisting role="php">
@@ -783,54 +874,58 @@
$b = array("uno", "dos", "tres", "cuatro", "cinco");
$c = array_map("show_Spanish", $a, $b);
-
print_r($c);
-// will output:
-// Array
-// (
-// [0] => The number 1 is called uno in Spanish
-// [1] => The number 2 is called dos in Spanish
-// [2] => The number 3 is called tres in Spanish
-// [3] => The number 4 is called cuatro in Spanish
-// [4] => The number 5 is called cinco in Spanish
-// )
-
$d = array_map("map_Spanish", $a , $b);
-
print_r($d);
-
-// will output:
-// Array
-// (
-// [0] => Array
-// (
-// [1] => uno
-// )
-//
-// [1] => Array
-// (
-// [2] => dos
-// )
-//
-// [2] => Array
-// (
-// [3] => tres
-// )
-//
-// [3] => Array
-// (
-// [4] => cuatro
-// )
-//
-// [4] => Array
-// (
-// [5] => cinco
-// )
-//
-// )
]]>
</programlisting>
+ <para>
+ This results:
+ <screen>
+<![CDATA[
+// printout of $c
+Array
+(
+ [0] => The number 1 is called uno in Spanish
+ [1] => The number 2 is called dos in Spanish
+ [2] => The number 3 is called tres in Spanish
+ [3] => The number 4 is called cuatro in Spanish
+ [4] => The number 5 is called cinco in Spanish
+)
+
+// printout of $d
+Array
+(
+ [0] => Array
+ (
+ [1] => uno
+ )
+
+ [1] => Array
+ (
+ [2] => dos
+ )
+
+ [2] => Array
+ (
+ [3] => tres
+ )
+
+ [3] => Array
+ (
+ [4] => cuatro
+ )
+
+ [4] => Array
+ (
+ [5] => cinco
+ )
+
+)
+]]>
+ </screen>
+ </para>
</example>
</para>
<para>
@@ -856,52 +951,57 @@
$d = array_map(null, $a, $b, $c);
print_r($d);
-
-// will output:
-// Array
-// (
-// [0] => Array
-// (
-// [0] => 1
-// [1] => one
-// [2] => uno
-// )
-//
-// [1] => Array
-// (
-// [0] => 2
-// [1] => two
-// [2] => dos
-// )
-//
-// [2] => Array
-// (
-// [0] => 3
-// [1] => three
-// [2] => tres
-// )
-//
-// [3] => Array
-// (
-// [0] => 4
-// [1] => four
-// [2] => cuatro
-// )
-//
-// [4] => Array
-// (
-// [0] => 5
-// [1] => five
-// [2] => cinco
-// )
-//
-// )
]]>
</programlisting>
</example>
+ <para>
+ The printout of the program above will be:
+ <screen>
+<![CDATA[
+Array
+(
+ [0] => Array
+ (
+ [0] => 1
+ [1] => one
+ [2] => uno
+ )
+
+ [1] => Array
+ (
+ [0] => 2
+ [1] => two
+ [2] => dos
+ )
+
+ [2] => Array
+ (
+ [0] => 3
+ [1] => three
+ [2] => tres
+ )
+
+ [3] => Array
+ (
+ [0] => 4
+ [1] => four
+ [2] => cuatro
+ )
+
+ [4] => Array
+ (
+ [0] => 5
+ [1] => five
+ [2] => cinco
+ )
+
+)
+]]>
+ </screen>
+ </para>
</para>
<para>
- See also <function>array_filter</function>,
+ See also <function>array_filter</function> and
<function>array_reduce</function>.
</para>
</refsect1>
@@ -945,13 +1045,26 @@
$result = array_merge ($array1, $array2);
]]>
</programlisting>
+ <para>
+ The <literal>$result</literal> will be:
+ <screen role="php">
+<![CDATA[
+Array
+(
+ [color] => green
+ [0] => 2
+ [1] => 4
+ [2] => a
+ [3] => b
+ [shape] => trapezoid
+ [4] => 4
+)
+]]>
+ </screen>
+ </para>
</example>
</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>
@@ -997,13 +1110,32 @@
$result = array_merge_recursive ($ar1, $ar2);
]]>
</programlisting>
+ <para>
+ The <literal>$result</literal> will be:
+ <screen role="php">
+<![CDATA[
+Array
+(
+ [color] => Array
+ (
+ [favorite] => Array
+ (
+ [0] => red
+ [1] => green
+ )
+
+ [0] => blue
+ )
+
+ [0] => 5
+ [1] => 10
+)
+]]>
+ </screen>
+ </para>
</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>
@@ -1198,17 +1330,27 @@
<title><function>array_pop</function> example</title>
<programlisting role="php">
<![CDATA[
-$stack = array ("orange", "apple", "raspberry");
+$stack = array ("orange", "banana", "apple", "raspberry");
$fruit = array_pop ($stack);
]]>
</programlisting>
+ <para>
+ After this, <varname>$stack</varname> will have only 3 elements:
+ <screen role="php">
+<![CDATA[
+Array
+(
+ [0] => orange
+ [1] => banana
+ [2] => apple
+)
+]]>
+ </screen>
+ and <literal>rasberry</literal> will be assigned to
+ <varname>$fruit</varname>.
+ </para>
</example>
</para>
- <para>
- After this, <varname>$stack</varname> has only 2 elements:
- "orange" and "apple", and <varname>$fruit</varname> has
- "raspberry".
- </para>
&return.falseproblem;
<para>
See also <function>array_push</function>,
@@ -1258,18 +1400,29 @@
<title><function>array_push</function> example</title>
<programlisting role="php">
<![CDATA[
-$stack = array (1, 2);
-array_push ($stack, "+", 3);
+$stack = array ("orange", "banana");
+array_push ($stack, "apple", "raspberry");
]]>
</programlisting>
+ <para>
+ This example would result in <varname>$stack</varname> having
+ the following elements:
+ <screen role="php">
+<![CDATA[
+Array
+(
+ [0] => orange
+ [1] => banana
+ [2] => apple
+ [3] => raspberry
+)
+]]>
+ </screen>
+ </para>
</example>
</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>,
+ See also <function>array_pop</function>,
<function>array_shift</function>, and
<function>array_unshift</function>.
</para>
@@ -1357,20 +1510,47 @@
<title><function>array_reverse</function> example</title>
<programlisting role="php">
<![CDATA[
-$input = array ("php", 4.0, array ("green", "red"));
+$input = array ("php", 4.0, array ("green", "red"));
$result = array_reverse ($input);
$result_keyed = array_reverse ($input, TRUE);
]]>
</programlisting>
+ <para>
+ This makes both <varname>$result</varname> and
+ <varname>$result_keyed</varname> have the same elements, but
+ note the difference between the keys. The printout of
+ <varname>$result</varname> and
+ <varname>$result_keyed</varname> will be:
+ <screen role="php">
+<![CDATA[
+Array
+(
+ [0] => Array
+ (
+ [0] => green
+ [1] => red
+ )
+
+ [1] => 4
+ [2] => php
+)
+Array
+(
+ [2] => Array
+ (
+ [0] => green
+ [1] => red
+ )
+
+ [1] => 4
+ [0] => php
+)
+]]>
+ </screen>
+ </para>
+
</example>
</para>
- <para>
- This makes both <varname>$result</varname> and
- <varname>$result_keyed</varname> be <literal>array(array
- ("green", "red"), 4.0, "php")</literal>. But
- <varname>$result_keyed[0]</varname> is still
- <literal>"php"</literal>.
- </para>
<note>
<para>
The second parameter was added in PHP 4.0.3.
@@ -1438,7 +1618,7 @@
<varname>$d</varname> containing <literal>1</literal>.
</para>
<para>
- See also <function>array_filter</function>,
+ See also <function>array_filter</function>, and
<function>array_map</function>.
</para>
</refsect1>
@@ -1471,19 +1651,30 @@
<title><function>array_shift</function> example</title>
<programlisting role="php">
<![CDATA[
-$args = array ("-v", "-f");
-$opt = array_shift ($args);
+$stack = array ("orange", "banana", "apple", "raspberry");
+$fruit = array_shift ($stack);
]]>
</programlisting>
+ <para>
+ This would result in <varname>$fruit</varname> having 3 elements left:
+ <screen role="php">
+<![CDATA[
+Array
+(
+ [0] => banana
+ [1] => apple
+ [2] => raspberry
+)
+]]>
+ </screen>
+ and <literal>orange</literal> will be assigned to
+ <varname>$fruit</varname>.
+ </para>
</example>
</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_push</function> and
<function>array_pop</function>.
</para>
</refsect1>
@@ -1536,10 +1727,10 @@
<![CDATA[
$input = array ("a", "b", "c", "d", "e");
-$output = array_slice ($input, 2); // returns "c", "d", and "e"
+$output = array_slice ($input, 2); // returns "c", "d" and "e"
$output = array_slice ($input, 2, -1); // returns "c", "d"
$output = array_slice ($input, -2, 1); // returns "d"
-$output = array_slice ($input, 0, 3); // returns "a", "b", and "c"
+$output = array_slice ($input, 0, 3); // returns "a", "b" and "c"
]]>
</programlisting>
</example>
@@ -1673,7 +1864,7 @@
<funcsynopsis>
<funcprototype>
<funcdef>mixed <function>array_sum</function></funcdef>
- <paramdef>array <parameter>arr</parameter></paramdef>
+ <paramdef>array <parameter>array</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
@@ -1687,13 +1878,20 @@
<![CDATA[
$a = array(2, 4, 6, 8);
echo "sum(a) = ".array_sum($a)."\n";
-// prints: sum(a) = 20
$b = array("a"=>1.2,"b"=>2.3,"c"=>3.4);
echo "sum(b) = ".array_sum($b)."\n";
-// prints: sum(b) = 6.9
]]>
</programlisting>
+ <para>
+ The printout of the program above will be:
+ <screen role="php">
+<![CDATA[
+sum(a) = 20
+sum(b) = 6.9
+]]>
+ </screen>
+ </para>
</example>
</para>
<note>
@@ -1726,9 +1924,11 @@
without duplicate values.
</para>
<para>
- Note that keys are preserved. <function>array_unique</function> will
- keep the first key encountered for every value, and ignore all
- following keys.
+ Note that keys are preserved. <function>array_unique</function> sorts
+ the values treated as string at first, then will keep the first key
+ encountered for every value, and ignore all following keys. It does not
+ mean that the key of the first related value from the unsorted
+ <parameter>array</parameter> will be kept.
</para>
<note>
<simpara>
@@ -1755,15 +1955,21 @@
$input = array ("a" => "green", "red", "b" => "green", "blue", "red");
$result = array_unique ($input);
print_r($result);
-// this will output :
-//Array
-//(
-// [a] => green
-// [0] => red
-// [1] => blue
-//)
]]>
</programlisting>
+ <para>
+ This will output:
+ <screen role="php">
+<![CDATA[
+Array
+(
+ [b] => green
+ [1] => blue
+ [2] => red
+)
+]]>
+ </screen>
+ </para>
</example>
</para>
<para>
@@ -1774,17 +1980,21 @@
$input = array (4,"4","3",4,3,"3");
$result = array_unique ($input);
var_dump($result);
-
-/* output:
+]]>
+ </programlisting>
+ <para>
+ The printout of the program above will be (PHP 4.0.6):
+ <screen role="php">
+<![CDATA[
array(2) {
- [0]=>
- int(4)
- [1]=>
- string(1) "3"
+ [3]=>
+ int(4)
+ [4]=>
+ int(3)
}
-*/
]]>
- </programlisting>
+ </screen>
+ </para>
</example>
</para>
</refsect1>
@@ -1826,19 +2036,30 @@
<title><function>array_unshift</function> example</title>
<programlisting role="php">
<![CDATA[
-$queue = array ("p1", "p3");
-array_unshift ($queue, "p4", "p5", "p6");
+$queue = array ("orange", "banana");
+array_unshift ($queue, "apple", "raspberry");
]]>
</programlisting>
+ <para>
+ This would result in <varname>$queue</varname> having the
+ following elements:
+ <screen role="php">
+<![CDATA[
+Array
+(
+ [0] => apple
+ [1] => raspberry
+ [2] => orange
+ [3] => banana
+)
+]]>
+ </screen>
+ </para>
</example>
</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_push</function> and
<function>array_pop</function>.
</para>
</refsect1>
@@ -1867,9 +2088,21 @@
<programlisting role="php">
<![CDATA[
$array = array ("size" => "XL", "color" => "gold");
-array_values ($array); // returns array ("XL", "gold")
+print_r(array_values ($array));
]]>
</programlisting>
+ <para>
+ This will output:
+ <screen role="php">
+<![CDATA[
+Array
+(
+ [0] => XL
+ [1] => gold
+)
+]]>
+ </screen>
+ </para>
</example>
</para>
<note>
@@ -1913,7 +2146,7 @@
<funcsynopsis>
<funcprototype>
<funcdef>int <function>array_walk</function></funcdef>
- <paramdef>array <parameter>arr</parameter></paramdef>
+ <paramdef>array <parameter>array</parameter></paramdef>
<paramdef>string <parameter>func</parameter></paramdef>
<paramdef>mixed
<parameter><optional>userdata</optional></parameter>
@@ -1922,7 +2155,7 @@
</funcsynopsis>
<simpara>
Applies the user-defined function named by <parameter>func</parameter>
- to each element of <parameter>arr</parameter>.
+ to each element of <parameter>array</parameter>.
<parameter>func</parameter> will be passed array value as the
first parameter and array key as the second parameter. If
<parameter>userdata</parameter> is supplied, it will be passed as
@@ -1980,14 +2213,32 @@
function test_print ($item2, $key) {
echo "$key. $item2<br>\n";
}
-
+echo "Before ...:\n";
array_walk ($fruits, 'test_print');
reset ($fruits);
array_walk ($fruits, 'test_alter', 'fruit');
+echo "... and after:\n";
reset ($fruits);
array_walk ($fruits, 'test_print');
]]>
</programlisting>
+ <para>
+ The printout of the program above will be:
+ <screen role="php">
+<![CDATA[
+Before ...:
+d. lemon
+a. orange
+b. banana
+c. apple
+... and after:
+d. fruit: lemon
+a. fruit: orange
+b. fruit: banana
+c. fruit: apple
+]]>
+ </screen>
+ </para>
</example>
</para>
<simpara>
@@ -2054,8 +2305,8 @@
see <function>sort</function>.
</para>
<para>
- See also: <function>asort</function>, <function>rsort</function>,
- <function>ksort</function>, and <function>sort</function>.
+ See also <function>asort</function>, <function>rsort</function>,
+ <function>ksort</function> and <function>sort</function>.
</para>
</refsect1>
</refentry>
@@ -2117,7 +2368,7 @@
</para>
<para>
See also <function>arsort</function>, <function>rsort</function>,
- <function>ksort</function>, and <function>sort</function>.
+ <function>ksort</function> and <function>sort</function>.
</para>
</refsect1>
</refentry>
@@ -2173,9 +2424,17 @@
]]>
</programlisting>
<para>
- After this, <varname>$result</varname> will be <literal>array
- ("event" => "SIGGRAPH", "city" => "San Francisco",
- "state" => "CA")</literal>.
+ After this, <varname>$result</varname> will be:
+ <screen role="php">
+<![CDATA[
+Array
+(
+ [event] => SIGGRAPH
+ [city] => San Francisco
+ [state] => CA
+)
+]]>
+ </screen>
</para>
</example>
</para>
@@ -2244,8 +2503,8 @@
</para>
<note>
<para>
- The <function>sizeof</function> function is an alias for
- <function>count</function>.
+ The <function>sizeof</function> function is an
+ <link linkend="aliases">alias</link> for <function>count</function>.
</para>
</note>
<para>
@@ -2293,8 +2552,8 @@
</warning>
</para>
<para>
- See also: <function>end</function>, <function>next</function>,
- <function>prev</function>, and <function>reset</function>.
+ See also <function>end</function>, <function>next</function>,
+ <function>prev</function> and<function>reset</function>.
</para>
</refsect1>
</refentry>
@@ -2398,7 +2657,7 @@
<para>
See also <function>key</function>, <function>list</function>,
<function>current</function>, <function>reset</function>,
- <function>next</function>, and <function>prev</function>.
+ <function>next</function> and<function>prev</function>.
</para>
</refsect1>
</refentry>
@@ -2423,9 +2682,9 @@
internal pointer to the last element, and returns that element.
</para>
<para>
- See also: <function>current</function>,
+ See also <function>current</function>,
<function>each</function>,
- <function>next</function>, and <function>reset</function>.
+ <function>next</function> and<function>reset</function>.
</para>
</refsect1>
</refentry>
@@ -2588,7 +2847,7 @@
will not produce results.
</para>
<para>
- See also: <function>compact</function>.
+ See also <function>compact</function>.
</para>
</refsect1>
</refentry>
@@ -2636,11 +2895,20 @@
if (in_array ("Irix", $os)) {
print "Got Irix";
}
-if (in_array ("mac", $os)) { # fails because in_array() is case-sensitive
+if (in_array ("mac", $os)) {
print "Got mac";
}
]]>
</programlisting>
+ <para>
+ The second condition fails because <function>in_array()</function>
+ is case-sensitive, so the program above will display:
+ <screen role="php">
+<![CDATA[
+Got Irix
+]]>
+ </screen>
+ </para>
</example>
</para>
<para>
@@ -2656,12 +2924,16 @@
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>
+ <para>
+ This will display:
+ <screen role="php">
+<![CDATA[
+1.13 found with strict check
+]]>
+ </screen>
+ </para>
</example>
</para>
<para>
@@ -2766,16 +3038,14 @@
This example would display:
</para>
<para>
- <informalexample>
- <programlisting>
+ <screen>
<![CDATA[
d = lemon
c = apple
b = banana
a = orange
]]>
- </programlisting>
- </informalexample>
+ </screen>
</para>
<para>
You may modify the behavior of the sort using the optional
@@ -2784,8 +3054,8 @@
</para>
<simpara>
See also <function>asort</function>, <function>arsort</function>,
- <function>ksort</function> <function>sort</function>,
- <function>natsort</function>and <function>rsort</function>.
+ <function>ksort</function>, <function>sort</function>,
+ <function>natsort</function> and <function>rsort</function>.
</simpara>
</refsect1>
</refentry>
@@ -2827,16 +3097,14 @@
This example would display:
</para>
<para>
- <informalexample>
- <programlisting>
+ <screen>
<![CDATA[
a = orange
b = banana
c = apple
d = lemon
]]>
- </programlisting>
- </informalexample>
+ </screen>
</para>
<para>
You may modify the behavior of the sort using the optional
@@ -2845,7 +3113,7 @@
</para>
<simpara>
See also <function>asort</function>, <function>arsort</function>,
- <function>sort</function>, <function>natsort</function>, and
+ <function>sort</function>, <function>natsort</function> and
<function>rsort</function>.
</simpara>
<note>
@@ -2952,8 +3220,7 @@
The code above will generate the following output:
</para>
<para>
- <informalexample>
- <programlisting>
+ <screen>
<![CDATA[
Standard sorting
Array
@@ -2973,8 +3240,7 @@
[0] => img12.png
)
]]>
- </programlisting>
- </informalexample>
+ </screen>
For more information see: Martin Pool's <ulink
url="&url.strnatcmp;">Natural Order String Comparison</ulink>
page.
@@ -3066,9 +3332,9 @@
</warning>
</para>
<para>
- See also:
+ See also
<function>current</function>, <function>end</function>,
- <function>prev</function>, and <function>reset</function>.
+ <function>prev</function> and<function>reset</function>.
</para>
</refsect1>
</refentry>
@@ -3087,10 +3353,11 @@
</funcprototype>
</funcsynopsis>
<simpara>
- This is an alias for <function>current</function>.
+ This is an <link linkend="aliases">alias</link>
+ for <function>current</function>.
</simpara>
<para>
- See also:
+ See also
<function>end</function>, <function>next</function>,
<function>prev</function> and <function>reset</function>.
</para>
@@ -3129,8 +3396,8 @@
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>
@@ -3225,7 +3492,7 @@
element.
</para>
<para>
- See also: <function>current</function>,
+ See also <function>current</function>,
<function>each</function>, <function>next</function>,
and <function>prev</function>.
</para>
@@ -3268,16 +3535,14 @@
This example would display:
</para>
<para>
- <informalexample>
- <programlisting>
+ <screen>
<![CDATA[
0 = orange
1 = lemon
2 = banana
3 = apple
]]>
- </programlisting>
- </informalexample>
+ </screen>
</para>
<para>
The fruits have been sorted in reverse alphabetical order.
@@ -3288,9 +3553,9 @@
see <function>sort</function>.
</para>
<para>
- See also: <function>arsort</function>,
+ See also <function>arsort</function>,
<function>asort</function>, <function>ksort</function>,
- <function>sort</function>, and <function>usort</function>.
+ <function>sort</function> and<function>usort</function>.
</para>
</refsect1>
</refentry>
@@ -3348,8 +3613,8 @@
</funcprototype>
</funcsynopsis>
<para>
- The <function>sizeof</function> function is an alias for
- <function>count</function>.
+ The <function>sizeof</function> function is an
+ <link linkend="aliases">alias</link> for <function>count</function>.
</para>
<para>
See also <function>count</function>.
@@ -3398,16 +3663,14 @@
This example would display:
</para>
<para>
- <informalexample>
- <programlisting>
+ <screen>
<![CDATA[
fruits[0] = apple
fruits[1] = banana
fruits[2] = lemon
fruits[3] = orange
]]>
- </programlisting>
- </informalexample>
+ </screen>
</para>
<para>
The fruits have been sorted in alphabetical order.
@@ -3431,7 +3694,7 @@
</itemizedlist>
</para>
<para>
- See also: <function>arsort</function>,
+ See also <function>arsort</function>,
<function>asort</function>, <function>ksort</function>,
<function>natsort</function>, <function>natcasesort</function>,
<function>rsort</function>, <function>usort</function>,
@@ -3479,7 +3742,7 @@
</note>
¬e.func-callback;
<para>
- See also: <function>usort</function>, <function>uksort</function>,
+ See also <function>usort</function>, <function>uksort</function>,
<function>sort</function>, <function>asort</function>,
<function>arsort</function>, <function>ksort</function>
and <function>rsort</function>.
@@ -3532,20 +3795,18 @@
This example would display:
</para>
<para>
- <informalexample>
- <programlisting>
+ <screen>
<![CDATA[
20: twenty
10: ten
4: four
3: three
]]>
- </programlisting>
- </informalexample>
+ </screen>
</para>
¬e.func-callback;
<para>
- See also: <function>usort</function>, <function>uasort</function>,
+ See also <function>usort</function>, <function>uasort</function>,
<function>sort</function>, <function>asort</function>,
<function>arsort</function>, <function>ksort</function>,
<function>natsort</function> and <function>rsort</function>.
@@ -3583,10 +3844,6 @@
sorted array is undefined.
</para>
<para>
- It is also possible to use a member function of an object as the
- comparison function. See example number 3 below.
- </para>
- <para>
<example>
<title><function>usort</function> example</title>
<programlisting role="php">
@@ -3611,8 +3868,7 @@
This example would display:
</para>
<para>
- <informalexample>
- <programlisting>
+ <screen>
<![CDATA[
0: 6
1: 5
@@ -3620,8 +3876,7 @@
3: 2
4: 1
]]>
- </programlisting>
- </informalexample>
+ </screen>
</para>
<note>
<para>
@@ -3661,17 +3916,15 @@
This example would display:
</para>
<para>
- <informalexample>
- <programlisting>
+ <screen>
<![CDATA[
$fruits[0]: apples
$fruits[1]: grapes
$fruits[2]: lemons
]]>
- </programlisting>
- </informalexample>
+ </screen>
</para>
-
+ ¬e.func-callback;
<para>
<example>
<title>
@@ -3714,13 +3967,11 @@
This example would display:
</para>
<para>
- <informalexample>
- <programlisting>
+ <screen>
b
c
d
- </programlisting>
- </informalexample>
+ </screen>
</para>
<warning>
<para>
@@ -3730,11 +3981,11 @@
</para>
</warning>
<para>
- See also: <function>uasort</function>,
+ See also <function>uasort</function>,
<function>uksort</function>, <function>sort</function>,
<function>asort</function>,
<function>arsort</function>,<function>ksort</function>,
- <function>natsort</function>, and <function>rsort</function>.
+ <function>natsort</function> and<function>rsort</function>.
</para>
</refsect1>
</refentry>