Lumio Posted January 19, 2008 Share Posted January 19, 2008 Hello... I start with an array like that: Array ( [iNBOX] => Array ( [Drafts] => Array() [hello world] => Array ( [test] => Array ( [lala] => Array() [alo] => Array() [me] => Array() ) [lala] => Array() ) [sent] => Array() [Trash] => Array() ) ) Now I want to sort them all. I made a function that doese... nearly... <?php //classname: qMail private function sortFolders($array) { ksort($array); echo '<pre>'; print_r($array); '</pre>'; foreach ($array as $i => $a) $array[$i] = $this->sortFolders($a); return $array; } ?> Now it turns out the following array: Array ( [iNBOX] => Array ( [Drafts] => Array() [sent] => Array() [Trash] => Array() [hello world] => Array ( [lala] => Array() [test] => Array ( [alo] => Array() [lala] => Array() [me] => Array() ) ) ) ) But "hello world" should be the second one. //edit: I see... it is case-sensitive too. Link to comment https://forums.phpfreaks.com/topic/86839-solved-ksort-doesnt-sort-right/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.