Re: Array-sorting acting strangely??

From: Date: Tue, 09 May 2000 21:56:23 +0000
Subject: Re: Array-sorting acting strangely??
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-18548@lists.php.net to get a copy of this message
On Tue, 09 May 2000, Kasper Skårhøj wrote: > Sorting an array with values of mixed types (strings and integers) results in something which > doesn't seem to be a sorted list of the values! > > In my particular case I have an array where the keys are associative and a mix of strings and > integers. When I sort the array (ksort) the keys are not sorted correctly in any way. If I sort it > again it's even differently sorted! > > Try the attached script. Everything is being sorted just the way it's supposed to be. "10." is a string key which is less than 10 (numeric key), so it comes earlier in the list. -Andrei * E Pluribus UNIX. *

« previous php.dev (#18548) next »