added krsort docs

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@13411 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Thies C. Arntzen 1999-09-21 14:41:01 +00:00
parent 9020297a33
commit 1af9bafd9f

View file

@ -1138,6 +1138,47 @@ if (in_array("Irix", $os))
</refsect1>
</refentry>
<refentry id="function.krsort">
<refnamediv>
<refname>krsort</refname>
<refpurpose>Sort an array by key in reverse order</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>krsort</function></funcdef>
<paramdef>array <parameter>array</parameter></paramdef>
</funcsynopsis>
<para>
Sorts an array by key in reverse order, maintaining key to data correlations. This
is useful mainly for associative arrays.
<example>
<title><function>krsort</function> example</title>
<programlisting>
$fruits = array("d"=>"lemon","a"=>"orange","b"=>"banana","c"=>"apple");
krsort($fruits);
for(reset($fruits); $key = key($fruits); next($fruits)) {
echo "fruits[$key] = ".$fruits[$key]."\n";
}
</programlisting></example>
This example would display:
<computeroutput>
fruits[d] = lemon
fruits[c] = apple
fruits[b] = banana
fruits[a] = orange
</computeroutput>
<simpara>
See also <function>asort</function>, <function>arsort</function>, <function>ksort</function>
<function>sort</function>, and <function>rsort</function>.
</refsect1>
</refentry>
<refentry id="function.ksort">
<refnamediv>