updating/expanding as per errata.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@34041 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Ron Chmara 2000-10-18 05:46:56 +00:00
parent 2cd1551c89
commit 73f8077451

View file

@ -1295,6 +1295,9 @@ fruits[a] = orange
In short, it does the opposite of <function>extract</function>.
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>
@ -1305,7 +1308,7 @@ $event = "SIGGRAPH";
$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"
@ -1351,6 +1354,27 @@ $result = compact ("event", $location_vars);
</para>
</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
@ -1651,6 +1675,13 @@ blue, large, sphere, medium
<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 @@ blue, large, sphere, medium
<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 @@ fruits[d] = lemon
<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 @@ fruits[3] = apple
</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 @@ fruits[3] = orange
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>