From 1af9bafd9ffb6d0f8cda71070cb11fa90a82280b Mon Sep 17 00:00:00 2001 From: "Thies C. Arntzen" Date: Tue, 21 Sep 1999 14:41:01 +0000 Subject: [PATCH] added krsort docs git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@13411 c90b9560-bf6c-de11-be94-00142212c4b1 --- functions/array.sgml | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/functions/array.sgml b/functions/array.sgml index 1ed4490f9b..87d0ac1324 100644 --- a/functions/array.sgml +++ b/functions/array.sgml @@ -1138,6 +1138,47 @@ if (in_array("Irix", $os)) + + + krsort + Sort an array by key in reverse order + + + Description + + int krsort + array array + + + + Sorts an array by key in reverse order, maintaining key to data correlations. This + is useful mainly for associative arrays. + + + <function>krsort</function> example + +$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"; +} + + This example would display: + +fruits[d] = lemon +fruits[c] = apple +fruits[b] = banana +fruits[a] = orange + + + + See also asort, arsort, ksort + sort, and rsort. + + + + +