|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-05-01 07:01 UTC] blazeroni at yahoo dot 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. =)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 08:00:02 2025 UTC |
natsort() retains the keys, use foreach ($array as $value) { echo $value."\n"; } Derick