Re: PHP 4.0 Bug #5019 Updated: ksort is broken

From: Date: Wed, 14 Jun 2000 17:07:38 +0000
Subject: Re: PHP 4.0 Bug #5019 Updated: ksort is broken
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-21322@lists.php.net to get a copy of this message
> This is due to PHP's attempt at "smart" comparison when comparing numbers > and strings. String "12" will be interpreted as number 12, but "a" is > interpreted > as 0. It's possible to specify the sort order by providing an optional second > argument to sorting functions: SORT_REGULAR, SORT_NUMERIC, and > SORT_STRING. Try ksort($ls, SORT_STRING). Oh, thanks, it works :-) I think it should be documented, though... And also included in the incompatibility list, or change the default behaviour to SORT_STRING, which looks like is what PHP 3 does. -Ricardo <massaro@nextis.com.br>

« previous php.dev (#21322) next »