Bug #16942 Updated: natsort broken

From: Date: Wed, 01 May 2002 11:13:28 +0000
Subject: Bug #16942 Updated: natsort broken
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-6635@lists.php.net to get a copy of this message
ID: 16942 Updated by: derick@php.net Reported By: blazeroni@yahoo.com -Status: Open +Status: Bogus Bug Type: Arrays related Operating System: Linux PHP Version: 4.1.2 New Comment: natsort() retains the keys, use foreach ($array as $value) { echo $value."\n"; } Derick Previous Comments: ------------------------------------------------------------------------ [2002-05-01 07:01:48] blazeroni@yahoo.com There's something wrong with the natsort() algorithm. I sorted an array and echo'ed it out using the following code: ------------------------------------------------- $array = array("d02", "d3", "j_j", "d04", "d03"); natsort($array); for ($i=0; $array[$i]; $i++) { echo "[".$i."]: ".$array[$i]."\n"; } ------------------------------------------------- Here's what it spit out: ------------ [0]: d02 [1]: d3 [2]: j_j [3]: d04 [4]: d03 ------------ I'm not sure what kind of ordering it used, but it doesn't seem to follow any pattern that I know of. =) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=16942&edit=1

« previous php.bugs (#6635) next »