cvs: /phpdoc/functions array.sgml

From: Date: Tue, 21 Sep 1999 14:41:01 +0000
Subject: cvs: /phpdoc/functions array.sgml
Groups: php.dev 
Request: Send a blank email to php-dev+get-11147@lists.php.net to get a copy of this message
thies Tue Sep 21 10:41:01 1999 EDT Modified files: /phpdoc/functions array.sgml Log: added krsort docs Index: phpdoc/functions/array.sgml diff -u phpdoc/functions/array.sgml:1.23 phpdoc/functions/array.sgml:1.24 --- phpdoc/functions/array.sgml:1.23 Mon Sep 20 06:25:50 1999 +++ phpdoc/functions/array.sgml Tue Sep 21 10:41:01 1999 @@ -1138,6 +1138,47 @@ </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>

« previous php.dev (#11147) next »