From:             [EMAIL PROTECTED]
Operating system: Linux
PHP version:      4.1.2
PHP Bug Type:     Arrays related
Bug description:  natsort broken

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 bug report at http://bugs.php.net/?id=16942&edit=1
-- 
Fixed in CVS:        http://bugs.php.net/fix.php?id=16942&r=fixedcvs
Fixed in release:    http://bugs.php.net/fix.php?id=16942&r=alreadyfixed
Need backtrace:      http://bugs.php.net/fix.php?id=16942&r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=16942&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=16942&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=16942&r=notwrong
Not enough info:     http://bugs.php.net/fix.php?id=16942&r=notenoughinfo
Submitted twice:     http://bugs.php.net/fix.php?id=16942&r=submittedtwice

Reply via email to