note 115440 added to function.krsort

From: Date: Wed, 23 Jul 2014 15:15:23 +0000
Subject: note 115440 added to function.krsort
Groups: php.notes 
Request: Send a blank email to php-notes+get-200042@lists.php.net to get a copy of this message
Note that you can sort subarrays within a larger structure without sorting the whole thing: <?php $fruits = array("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple", 'e' => array("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple")); krsort($fruits['e']); var_dump($fruits); ?> array(5) { ["d"]=> string(5) "lemon" ["a"]=> string(6) "orange" ["b"]=> string(6) "banana" ["c"]=> string(5) "apple" ["e"]=> array(4) { ["d"]=> string(5) "lemon" ["c"]=> string(5) "apple" ["b"]=> string(6) "banana" ["a"]=> string(6) "orange" } } You can see that it only sorts the items within the 'e' element. ---- Server IP: 213.172.110.14 Probable Submitter: 109.217.200.64 ---- Manual Page -- http://php.net/manual/en/function.krsort.php Edit -- https://master.php.net/note/edit/115440 Del: integrated -- https://master.php.net/note/delete/115440/integrated Del: useless -- https://master.php.net/note/delete/115440/useless Del: bad code -- https://master.php.net/note/delete/115440/bad+code Del: spam -- https://master.php.net/note/delete/115440/spam Del: non-english -- https://master.php.net/note/delete/115440/non-english Del: in docs -- https://master.php.net/note/delete/115440/in+docs Del: other reasons-- https://master.php.net/note/delete/115440 Reject -- https://master.php.net/note/reject/115440 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#200042) next »