note 30180 added to function.array-multisort
| From: | moriarty at rack1 dot php dot net | Date: | Sun, 09 Mar 2003 20:42:24 +0000 |
| Subject: | note 30180 added to function.array-multisort | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-45042@lists.php.net to get a copy of this message | ||
It should be noted that whilst the manuel says:
"It[array_multisort] maintains key association when sorting".
This is only Partially true.
It will maintain string keys and associates them properly.
However if you are using numeric keys, it will reset them to 0.
i.e.:
array(3) {
[10]=>
string(1) "a"
[11]=>
string(1) "e"
[2]=>
string(1) "b"
}
will become:
array(3) {
[0]=>
string(1) "a"
[1]=>
string(1) "b"
[2]=>
string(1) "c"
}
Although i'm not sure WHY this is the case, or why it's not documented in the manuel as
being the case.
--
http://www.php.net/manual/en/function.array-multisort.php
http://master.php.net/manage/user-notes.php?action=edit+30180
http://master.php.net/manage/user-notes.php?action=delete+30180
http://master.php.net/manage/user-notes.php?action=reject+30180