Date: 07/29/00
- Next message: Jani Taskinen: "[PHP-DOC] cvs: phpdoc /en/functions imap.xml"
- Previous message: Egon Schmid: "[PHP-DOC] cvs: phpdoc /en/functions apache.xml"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
eschmid Sat Jul 29 14:12:26 2000 EDT
Modified files:
/phpdoc/en/functions array.xml
Log:
Some cosmetic changes. There is a problem with quotes in the printed manual.
Index: phpdoc/en/functions/array.xml
diff -u phpdoc/en/functions/array.xml:1.15 phpdoc/en/functions/array.xml:1.16
--- phpdoc/en/functions/array.xml:1.15 Sun Jul 23 10:03:59 2000
+++ phpdoc/en/functions/array.xml Sat Jul 29 14:12:26 2000
@@ -14,12 +14,16 @@
<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>=></literal> operator.
+ </para>
+ <para>
<note>
<para>
<function>Array</function> is a language construct used to
@@ -109,12 +113,13 @@
$array2 = array ("b" => "green", "yellow", "red");
$result = array_intersect ($array1, $array2);
</programlisting>
- <para>
- This makes $result have array ("blue");
- </para>
</example>
</para>
<para>
+ This makes <varname>$result</varname> have <literal>array
+ ("blue");</literal>
+ </para>
+ <para>
See also <function>array_intersect</function>.
</para>
</refsect1>
@@ -178,12 +183,13 @@
$array2 = array ("b" => "green", "yellow", "red");
$result = array_intersect ($array1, $array2);
</programlisting>
- <para>
- This makes $result have array ("a" => "green", "red");
- </para>
</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>
@@ -247,7 +253,7 @@
<paramdef>array <parameter>array1</parameter></paramdef>
<paramdef>array <parameter>array2</parameter></paramdef>
<paramdef>array
- <parameter><optional> ...</optional></parameter>
+ <parameter><optional>...</optional></parameter>
</paramdef>
</funcprototype>
</funcsynopsis>
@@ -270,13 +276,13 @@
$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>
</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>
@@ -295,7 +301,7 @@
<paramdef>array <parameter>array1</parameter></paramdef>
<paramdef>array <parameter>array2</parameter></paramdef>
<paramdef>array
- <parameter><optional> ...</optional></parameter>
+ <parameter><optional>...</optional></parameter>
</paramdef>
</funcprototype>
</funcsynopsis>
@@ -320,13 +326,13 @@
$ar2 = array (10, "color" => array ("favorite" => "green", "blue"));
$result = array_merge_recursive ($ar1, $ar2);
</programlisting>
- <para>
- Resulting array will be array("color" => array("favorite" =>
- array("red", "green"), "blue"), 5, 10).
- </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>
@@ -406,34 +412,38 @@
<para>
Returns true on success, false on failure.
</para>
- <example>
- <title>Sorting multiple arrays</title>
- <programlisting role="php">
+ <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>
- <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>
- </example>
- <example>
- <title>Sorting multi-dimensional array</title>
- <programlisting role="php">
+ </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>
- <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>
- </example>
+ </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>
@@ -510,14 +520,14 @@
$stack = array ("orange", "apple", "raspberry");
$fruit = array_pop ($stack);
</programlisting>
- <para>
- After this, <varname>$stack</varname> has only 2 elements:
- "orange" and "apple", and <varname>$fruit</varname> 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>.
@@ -539,12 +549,11 @@
<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
<parameter>array</parameter> as a stack, and pushes the passed
@@ -567,6 +576,8 @@
array_push ($stack, "+", 3);
</programlisting>
</example>
+ </para>
+ <para>
This example would result in <varname>$stack</varname> having 4
elements: 1, 2, "+", and 3.
</para>
@@ -656,7 +667,10 @@
$result = array_reverse ($input);
</programlisting>
</example>
- This makes $result have array (array ("green", "red"), 4.0, "php").
+ </para>
+ <para>
+ This makes <varname>$result</varname> have <literal>array
+ (array ("green", "red"), 4.0, "php")</literal>.
</para>
</refsect1>
</refentry>
@@ -690,6 +704,8 @@
$opt = array_shift ($args);
</programlisting>
</example>
+ </para>
+ <para>
This would result in <varname>$args</varname> having one element
"-f" left, and <varname>$opt</varname> being "-v".
</para>
@@ -826,7 +842,7 @@
</para>
<para>
The following equivalences hold:
- <programlisting role="php">
+ <programlisting>
array_push ($input, $x, $y) array_splice ($input, count ($input), 0,
array ($x, $y))
array_pop ($input) array_splice ($input, -1)
@@ -885,11 +901,12 @@
$input = array ("a" => "green", "red", "b" => "green", "blue", "red");
$result = array_unique ($input);
</programlisting>
- <para>
- This makes $result have array ("a" => "green", "red", "blue");
- </para>
</example>
</para>
+ <para>
+ This makes <varname>$result</varname> have <literal>array ("a" =>
+ "green", "red", "blue");</literal>
+ </para>
</refsect1>
</refentry>
@@ -926,16 +943,18 @@
</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");
</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>.
@@ -1085,13 +1104,21 @@
}
</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>
@@ -1131,13 +1158,21 @@
}
</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>
@@ -1194,8 +1229,8 @@
$result = compact ("event", $location_vars);
</programlisting>
<para>
- After this, <varname>$result</varname> 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>
@@ -1334,7 +1369,6 @@
<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);
@@ -1623,13 +1657,19 @@
}
</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>
<simpara>
See also <function>asort</function>, <function>arsort</function>,
@@ -1666,13 +1706,19 @@
}
</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>
<simpara>
See also <function>asort</function>, <function>arsort</function>,
@@ -1921,13 +1967,21 @@
}
</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>
@@ -2023,13 +2077,21 @@
}
</programlisting>
</example>
+ </para>
+ <para>
This example would display:
- <computeroutput>
+ </para>
+ <para>
+ <informalexample>
+ <programlisting>
fruits[0] = apple
fruits[1] = banana
fruits[2] = lemon
fruits[3] = orange
- </computeroutput>
+ </programlisting>
+ </informalexample>
+ </para>
+ <para>
The fruits have been sorted in alphabetical order.
</para>
<para>
@@ -2088,7 +2150,8 @@
user-supplied comparison function. If the array you wish to sort
needs to be sorted by some non-trivial criteria, you should use
this function.
-
+ </para>
+ <para>
<example>
<title><function>Uksort</function> example</title>
<programlisting role="php">
@@ -2103,13 +2166,19 @@
}
</programlisting>
</example>
+ </para>
+ <para>
This example would display:
- <computeroutput>
+ </para>
+ <para>
+ <informalexample>
+ <programlisting>
20: twenty
10: ten
4: four
3: three
- </computeroutput>
+ </programlisting>
+ </informalexample>
</para>
<para>
See also: <function>arsort</function>,
@@ -2148,6 +2217,8 @@
be respectively less than, equal to, or greater than the
second. If two members compare as equal, their order in the
sorted array is undefined.
+ </para>
+ <para>
<example>
<title><function>Usort</function> example</title>
<programlisting role="php">
@@ -2162,14 +2233,22 @@
}
</programlisting>
</example>
+ </para>
+ <para>
This example would display:
- <computeroutput>
+ </para>
+ <para>
+ <informalexample>
+ <programlisting>
0: 6
1: 5
2: 3
3: 2
4: 1
- </computeroutput>
+ </programlisting>
+ </informalexample>
+ </para>
+ <para>
<note>
<para>
Obviously in this trivial case the <function>rsort</function>
- Next message: Jani Taskinen: "[PHP-DOC] cvs: phpdoc /en/functions imap.xml"
- Previous message: Egon Schmid: "[PHP-DOC] cvs: phpdoc /en/functions apache.xml"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

