eschmid Sat Sep 15 19:47:45 2001 EDT
Modified files:
/phpdoc/en/functions array.xml
Log:
Whitespace and some typos.
Index: phpdoc/en/functions/array.xml
diff -u phpdoc/en/functions/array.xml:1.95 phpdoc/en/functions/array.xml:1.96
--- phpdoc/en/functions/array.xml:1.95 Sat Sep 15 15:06:11 2001
+++ phpdoc/en/functions/array.xml Sat Sep 15 19:47:44 2001
@@ -1,5 +1,5 @@
<?xml encoding="iso-8859-1"?>
-<!-- $Revision: 1.95 $ -->
+<!-- $Revision: 1.96 $ -->
<reference id="ref.array">
<title>Array Functions</title>
<titleabbrev>Arrays</titleabbrev>
@@ -91,8 +91,7 @@
which will display :
<informalexample>
<programlisting>
-Array
-(
+Array (
[0] => 1
[1] => 1
[2] => 1
@@ -112,15 +111,14 @@
<example>
<title>1-based index with <function>array</function></title>
<programlisting role="php">
- $firstquarter = array(1 => 'January', 'February', 'March');
- print_r($firstquarter);
+$firstquarter = array(1 => 'January', 'February', 'March');
+print_r($firstquarter);
</programlisting>
</example>
which will display :
<informalexample>
<programlisting>
-Array
-(
+Array (
[1] => 'January'
[2] => 'February'
[3] => 'March'
@@ -225,7 +223,9 @@
<refentry id="function.array-filter">
<refnamediv>
<refname>array_filter</refname>
- <refpurpose>Filters elements of an array using a callback function</refpurpose>
+ <refpurpose>
+ Filters elements of an array using a callback function
+ </refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
@@ -250,11 +250,11 @@
<title><function>array_filter</function> example</title>
<programlisting role="php">
function odd($var) {
- return ($var % 2 == 1);
+ return ($var % 2 == 1);
}
function even($var) {
- return ($var % 2 == 0);
+ return ($var % 2 == 0);
}
$array1 = array ("a"=>1, "b"=>2, "c"=>3, "d"=>4, "e"=>5);
@@ -434,18 +434,19 @@
those still using PHP 3.
<example>
<title>
- Implementation of <function>array_keys</function> for PHP 3
- users
+ Implementation of <function>array_keys</function> for PHP 3
+ users
</title>
<programlisting role="php">
function array_keys ($arr, $term="") {
$t = array();
while (list($k,$v) = each($arr)) {
- if ($term && $v != $term)
+ if ($term && $v != $term) {
continue;
$t[] = $k;
}
return $t;
+ }
}
</programlisting>
</example>
@@ -460,7 +461,9 @@
<refentry id="function.array-map">
<refnamediv>
<refname>array_map</refname>
- <refpurpose>Applies the callback to the elements of the given arrays</refpurpose>
+ <refpurpose>
+ Applies the callback to the elements of the given arrays
+ </refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
@@ -475,18 +478,18 @@
</funcprototype>
</funcsynopsis>
<para>
- <function>array_map</function> returns an array
- containing all the elements of <parameter>arr1</parameter>
- after applying the callback function to each one.
- The number of parameters that the callback function accepts should
- match the number of arrays passed to the <function>array_map</function>
+ <function>array_map</function> returns an array containing all
+ the elements of <parameter>arr1</parameter> after applying the
+ callback function to each one. The number of parameters that the
+ callback function accepts should match the number of arrays
+ passed to the <function>array_map</function>
</para>
<para>
<example>
<title><function>array_map</function> example</title>
<programlisting role="php">
function cube($n) {
- return $n*$n*$n;
+ return $n*$n*$n;
}
$a = array(1, 2, 3, 4, 5);
@@ -503,11 +506,11 @@
<title><function>array_map</function> - using more arrays</title>
<programlisting role="php">
function show_Spanish($n, $m) {
- return "The number $n is called $m in Spanish";
+ return "The number $n is called $m in Spanish";
}
function map_Spanish($n, $m) {
- return array ($n => $m);
+ return array ($n => $m);
}
$a = array(1, 2, 3, 4, 5);
@@ -518,8 +521,7 @@
print_r($c);
// will output:
-// Array
-// (
+// 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
@@ -532,8 +534,7 @@
print_r($d);
// will output:
-// Array
-// (
+// Array (
// [0] => Array
// (
// [1] => uno
@@ -577,7 +578,7 @@
</para>
<para>
<example>
- <title><function>array_map</function> - creating an array of arrays</title>
+ <title>Creating an array of arrays</title>
<programlisting role="php">
$a = array(1, 2, 3, 4, 5);
$b = array("one", "two", "three", "four", "five");
@@ -1050,7 +1051,9 @@
<funcprototype>
<funcdef>array <function>array_reverse</function></funcdef>
<paramdef>array <parameter>array</parameter></paramdef>
- <paramdef>bool
<parameter><optional>preserve_keys</optional></parameter></paramdef>
+ <paramdef>bool
+ <parameter><optional>preserve_keys</optional></parameter>
+ </paramdef>
</funcprototype>
</funcsynopsis>
<para>
@@ -1070,8 +1073,9 @@
</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
+ 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>
@@ -1087,7 +1091,8 @@
<refnamediv>
<refname>array_reduce</refname>
<refpurpose>
- Iteratively reduce the array to a single value using a callback function
+ Iteratively reduce the array to a single value using a callback
+ function
</refpurpose>
</refnamediv>
<refsect1>
@@ -1103,7 +1108,7 @@
</funcprototype>
</funcsynopsis>
<para>
- <function>array_reduce</function> applies iteratively the
+ <function>array_reduce</function> applies iteratively the
<parameter>callback</parameter> function to the elements of the
array <parameter>input</parameter>, so as to reduce the array to
a single value. If the optional <parameter>intial</parameter> is
@@ -1115,13 +1120,13 @@
<title><function>array_reduce</function> example</title>
<programlisting role="php">
function rsum($v, $w) {
- $v += $w;
- return $v;
+ $v += $w;
+ return $v;
}
function rmul($v, $w) {
- $v *= $w;
- return $v;
+ $v *= $w;
+ return $v;
}
$a = array(1, 2, 3, 4, 5);
@@ -1135,8 +1140,8 @@
<para>
This will result in <varname>$b</varname> containing
<literal>15</literal>, <varname>$c</varname> containing
- <literal>1200</literal> (= 1*2*3*4*5*10), and <varname>$d</varname>
- containing <literal>1</literal>.
+ <literal>1200</literal> (= 1*2*3*4*5*10), and
+ <varname>$d</varname> containing <literal>1</literal>.
</para>
<para>
See also <function>array_filter</function>,
@@ -1164,9 +1169,8 @@
<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.
- If <parameter>array</parameter> is empty (or is not an array),
- &null; will be returned.
+ down. If <parameter>array</parameter> is empty (or is not an
+ array), &null; will be returned.
</para>
<para>
<example>
@@ -1314,7 +1318,7 @@
</para>
<para>
The following equivalences hold:
- <programlisting>
+ <programlisting role="php">
array_push ($input, $x, $y) array_splice ($input, count ($input), 0,
array ($x, $y))
array_pop ($input) array_splice ($input, -1)
@@ -1378,7 +1382,7 @@
<example>
<title><function>array_sum</function> examples</title>
<programlisting role="php">
-$a = array(2,4,6,8);
+$a = array(2, 4, 6, 8);
echo "sum(a) = ".array_sum($a)."\n";
// prints: sum(a) = 20
@@ -1554,8 +1558,8 @@
those still using PHP 3.
<example>
<title>
- Implementation of <function>array_values</function> for PHP 3
- users
+ Implementation of <function>array_values</function> for PHP 3
+ users
</title>
<programlisting role="php">
function array_values ($arr) {
@@ -1735,7 +1739,9 @@
<funcprototype>
<funcdef>void <function>asort</function></funcdef>
<paramdef>array <parameter>array</parameter></paramdef>
- <paramdef>int <parameter><optional>sort_flags</optional></parameter></paramdef>
+ <paramdef>int
+ <parameter><optional>sort_flags</optional></parameter>
+ </paramdef>
</funcprototype>
</funcsynopsis>
<para>
@@ -1833,8 +1839,9 @@
$result = compact ("event", "nothing_here", $location_vars);
</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 <literal>array
+ ("event" => "SIGGRAPH", "city" => "San Francisco",
+ "state" => "CA")</literal>.
</para>
</example>
</para>
@@ -1876,9 +1883,9 @@
</para>
</warning>
<para>
- Please see the <link linkend="language.types.array">Arrays</link>
- section of the manual for a detailed explanation of how arrays are
- implemented and used in PHP.
+ Please see the <link linkend="language.types.array">Arrays</link>
+ section of the manual for a detailed explanation of how arrays
+ are implemented and used in PHP.
</para>
<para>
<example>
@@ -1960,7 +1967,8 @@
<refnamediv>
<refname>each</refname>
<refpurpose>
- Return the current key and value pair from an array and advance the array cursor
+ Return the current key and value pair from an array and advance
+ the array cursor
</refpurpose>
</refnamediv>
<refsect1>
@@ -2115,10 +2123,11 @@
</para>
</note>
<para>
- <function>extract</function> checks each key to see whether if constitutes
- a valid variable name and also for collisions with existing variables in
- the symbol table. The way invalid/numeric keys and collisions are treated
- is determined by <parameter>extract_type</parameter>. It can be one of the
+ <function>extract</function> checks each key to see whether if
+ constitutes a valid variable name and also for collisions with
+ existing variables in the symbol table. The way invalid/numeric
+ keys and collisions are treated is determined by
+ <parameter>extract_type</parameter>. It can be one of the
following values:
<variablelist>
<varlistentry>
@@ -2150,8 +2159,9 @@
<term>EXTR_PREFIX_ALL</term>
<listitem>
<simpara>
- Prefix all variable names with <parameter>prefix</parameter>. Since PHP
- 4.0.5 this includes numeric ones as well.
+ Prefix all variable names with
+ <parameter>prefix</parameter>. Since PHP 4.0.5 this includes
+ numeric ones as well.
</simpara>
</listitem>
</varlistentry>
@@ -2160,7 +2170,8 @@
<listitem>
<simpara>
Only prefix invalid/numeric variable names with
- <parameter>prefix</parameter>. This flag has been added in PHP 4.0.5.
+ <parameter>prefix</parameter>. This flag has been added in
+ PHP 4.0.5.
</simpara>
</listitem>
</varlistentry>
@@ -2172,13 +2183,14 @@
</para>
<para>
Note that <parameter>prefix</parameter> is only required if
- <parameter>extract_type</parameter> is EXTR_PREFIX_SAME, EXTR_PREFIX_ALL,
- or EXTR_PREFIX_INVALID. If the prefixed result is not a valid variable
- name, it is not imported into the symbol table.
+ <parameter>extract_type</parameter> is EXTR_PREFIX_SAME,
+ EXTR_PREFIX_ALL, or EXTR_PREFIX_INVALID. If the prefixed result
+ is not a valid variable name, it is not imported into the symbol
+ table.
</para>
<para>
- <function>extract</function> returns the number of variables successfully
- imported into the symbol table.
+ <function>extract</function> returns the number of variables
+ successfully imported into the symbol table.
</para>
<para>
A possible use for extract is to import into symbol table
@@ -2266,9 +2278,9 @@
<title><function>in_array</function> example</title>
<programlisting role="php">
$os = array ("Mac", "NT", "Irix", "Linux");
-if (in_array ("Irix", $os)){
+if (in_array ("Irix", $os)) {
print "Got Irix";
- }
+}
</programlisting>
</example>
</para>
@@ -2301,7 +2313,8 @@
<refnamediv>
<refname>array_search</refname>
<refpurpose>
- Searches the array for a given value and returns the corresponding key if
successful
+ Searches the array for a given value and returns the
+ corresponding key if successful
</refpurpose>
</refnamediv>
<refsect1>
@@ -2549,8 +2562,8 @@
<example>
<title><function>natsort</function> example</title>
<programlisting role="php">
-$array1 = $array2 = array ("img12.png","img10.png","img2.png","img1.png");
-
+$array1 = $array2 = array ("img12.png", "img10.png", "img2.png", "img1.png");
+
sort($array1);
echo "Standard sorting\n";
print_r($array1);
@@ -2586,7 +2599,7 @@
)
</programlisting>
</informalexample>
- For more infomation see: Martin Pool's <ulink
+ For more information see: Martin Pool's <ulink
url="&url.strnatcmp;">Natural Order String Comparison</ulink>
page.
</para>
@@ -2765,29 +2778,29 @@
<para>
<function>range</function> returns an array of elements from
<parameter>low</parameter> to <parameter>high</parameter>,
- inclusive. If low > high, the sequence will be from high to
- low.
+ inclusive. If low > high, the sequence will be from high to low.
<example>
<title><function>range</function> examples</title>
<programlisting role="php">
-foreach(range(0,9) as $number) {
- echo $number;
+foreach(range(0, 9) as $number) {
+ echo $number;
}
-foreach(range('a','z') as $letter) {
- echo $letter;
+foreach(range('a', 'z') as $letter) {
+ echo $letter;
}
-foreach(range('z','a') as $letter) {
- echo $letter;
+foreach(range('z', 'a') as $letter) {
+ echo $letter;
}
</programlisting>
</example>
</para>
- <note>
- <para>
- Prior to version 4.0.7 the range() function only generated incrementing
integer arrays.
- Support for character sequences and decrementing arrays was added in 4.0.7.
- </para>
- </note>
+ <note>
+ <para>
+ Prior to version 4.0.7 the range() function only generated
+ incrementing integer arrays. Support for character sequences
+ and decrementing arrays was added in 4.0.7.
+ </para>
+ </note>
<para>
See <function>shuffle</function> for another example of its use.
</para>
@@ -2935,7 +2948,8 @@
</funcprototype>
</funcsynopsis>
<para>
- The <function>sizeof</function> function is an alias for
<function>count</function>.
+ The <function>sizeof</function> function is an alias for
+ <function>count</function>.
</para>
<para>
See also <function>count</function>.
@@ -2954,7 +2968,9 @@
<funcprototype>
<funcdef>void <function>sort</function></funcdef>
<paramdef>array <parameter>array</parameter></paramdef>
- <paramdef>int <parameter><optional>sort_flags</optional></parameter></paramdef>
+ <paramdef>int
+ <parameter><optional>sort_flags</optional></parameter>
+ </paramdef>
</funcprototype>
</funcsynopsis>
<para>
@@ -2962,7 +2978,7 @@
lowest to highest when this function has completed.
<example>
<title><function>sort</function> example</title>
- <programlisting role="php">
+ <programlisting role="php">
<?php
$fruits = array ("lemon", "orange", "banana", "apple");
@@ -2994,7 +3010,7 @@
</para>
<para>
The optional second parameter <parameter>sort_flags</parameter>
- may be used to modify the sorting behavior using theese valies:
+ may be used to modify the sorting behavior using these values:
</para>
<para>
Sorting type flags:
@@ -3015,7 +3031,8 @@
<function>asort</function>, <function>ksort</function>,
<function>natsort</function>, <function>natcasesort</function>,
<function>rsort</function>, <function>usort</function>,
- <function>array_multisort</function>, and <function>uksort</function>.
+ <function>array_multisort</function>, and
+ <function>uksort</function>.
</para>
<note>
<para>
@@ -3203,7 +3220,7 @@
</title>
<programlisting role="php">
function cmp ($a, $b) {
- return strcmp($a["fruit"],$b["fruit"]);
+ return strcmp($a["fruit"], $b["fruit"]);
}
$fruits[0]["fruit"] = "lemons";
@@ -3244,8 +3261,9 @@
</warning>
</para>
<para>
- See also: <function>uasort</function>, <function>uksort</function>,
- <function>sort</function>, <function>asort</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>.
</para>