note 103465 added to function.ksort

From: Date: Thu, 14 Apr 2011 15:48:33 +0000
Subject: note 103465 added to function.ksort
Groups: php.notes 
Request: Send a blank email to php-notes+get-178847@lists.php.net to get a copy of this message
Note that ksort will NOT help you much if numeric and string keys are mixed together. <?php $t = array( "a"=>"A", 0=>"A", "b"=>"A", 1=>"A" ); var_dump($t); ksort($t); var_dump($t); ?> produces (on PHP 5.3.6-4 with Suhosin-Patch) : array(4) { ["a"]=> string(1) "A" [0]=> string(1) "A" ["b"]=> string(1) "A" [1]=> string(1) "A" } array(4) { ["b"]=> string(1) "A" [0]=> string(1) "A" ["a"]=> string(1) "A" [1]=> string(1) "A" } note that the second array should be sorted by keys, but is even more messed up than the first one! ---- Server IP: 195.114.0.19 Probable Submitter: 81.190.218.49 ---- Manual Page -- http://www.php.net/manual/en/function.ksort.php Edit -- https://master.php.net/note/edit/103465 Del: integrated -- https://master.php.net/note/delete/103465/integrated Del: useless -- https://master.php.net/note/delete/103465/useless Del: bad code -- https://master.php.net/note/delete/103465/bad+code Del: spam -- https://master.php.net/note/delete/103465/spam Del: non-english -- https://master.php.net/note/delete/103465/non-english Del: in docs -- https://master.php.net/note/delete/103465/in+docs Del: other reasons-- https://master.php.net/note/delete/103465 Reject -- https://master.php.net/note/reject/103465 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#178847) next »