Date: 10/18/00
- Next message: Ron Chmara: "[PHP-DOC] International English Grammar check?"
- Previous message: Ron Chmara: "[PHP-DOC] cvs: phpdoc /en/functions mcrypt.xml"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ronabop Tue Oct 17 22:46:57 2000 EDT
Modified files:
/phpdoc/en/functions array.xml
Log:
updating/expanding as per errata.
Index: phpdoc/en/functions/array.xml
diff -u phpdoc/en/functions/array.xml:1.42 phpdoc/en/functions/array.xml:1.43
--- phpdoc/en/functions/array.xml:1.42 Tue Oct 10 16:16:41 2000
+++ phpdoc/en/functions/array.xml Tue Oct 17 22:46:56 2000
@@ -1296,6 +1296,9 @@
It returns the output array with all the variables added to it.
</para>
<para>
+ Any strings that are not set will simply be skipped.
+ </para>
+ <para>
<example>
<title><function>Compact</function> example</title>
<programlisting role="php">
@@ -1305,7 +1308,7 @@
$location_vars = array ("city", "state");
-$result = compact ("event", $location_vars);
+$result = compact ("event", "nothing_here", $location_vars);
</programlisting>
<para>
After this, <varname>$result</varname> will be <literal>array ("event"
@@ -1352,6 +1355,27 @@
</warning>
</para>
<para>
+ <example>
+ <title><function>Count</function> example</title>
+ <programlisting role="php">
+$a[0] = 1;
+$a[1] = 3;
+$a[2] = 5;
+$result = count ($a);
+//$result == 3, not 2, as there are 3 assigned elements
+
+$a[2] = 1;
+$a[4] = "";
+$a[6] = 5;
+$a[8] = 7;
+$a[10] = 11;
+$a[12] = "";
+$result = count ($a);
+// $result == 4, as there are 4 assigned elements
+ </programlisting>
+ </example>
+ </para>
+ <para>
See also: <function>sizeof</function>,
<function>isset</function>, and
<function>is_array</function>.
@@ -1651,6 +1675,13 @@
<varname>$wddx_size</varname>, and
<varname>$wddx_shape</varname>.
</para>
+ <para>
+ You must use an associative array, a numerically indexed array
+ will not produce results.
+ </para>
+ <para>
+ See also: <function>compact</function>.
+ </para>
</refsect1>
</refentry>
@@ -1678,8 +1709,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>
@@ -1820,6 +1852,11 @@
<function>sort</function>, <function>natsort</function>, and
<function>rsort</function>.
</simpara>
+ <note>
+ <para>
+ The second parameter was added in PHP 4.
+ </para>
+ </note>
</refsect1>
</refentry>
@@ -2227,12 +2264,13 @@
</funcsynopsis>
<para>
This function shuffles (randomizes the order of the elements in)
- an array.
+ an array. You must use <function>srand</function> to seed this
+ function.
<example>
<title><function>Shuffle</function> example</title>
<programlisting role="php">
$numbers = range (1,20);
-srand (time());
+srand ((double)microtime()*1000000);
shuffle ($numbers);
while (list (, $number) = each ($numbers)) {
echo "$number ";
@@ -2341,9 +2379,14 @@
See also: <function>arsort</function>,
<function>asort</function>, <function>ksort</function>,
<function>natsort</function>, <function>natcasesort</function>,
- <function>rsort</function>, <function>usort</function>
- and <function>uksort</function>.
+ <function>rsort</function>, <function>usort</function>,
+ <function>array_multisort</function>, and <function>uksort</function>.
</para>
+ <note>
+ <para>
+ The second parameter was added in PHP 4.
+ </para>
+ </note>
</refsect1>
</refentry>
- Next message: Ron Chmara: "[PHP-DOC] International English Grammar check?"
- Previous message: Ron Chmara: "[PHP-DOC] cvs: phpdoc /en/functions mcrypt.xml"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

