note 31254 added to function.array-multisort
| From: | steve at mg-rover dot org | Date: | Tue, 15 Apr 2003 13:40:46 +0000 |
| Subject: | note 31254 added to function.array-multisort | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-46642@lists.php.net to get a copy of this message | ||
As someone pointed out above, but I'll reiterate it, if you are using Numeric Keys, this
function resets the keys to 0, you need to manually change the key to a none numeric (add a
'_' onto the front, for example), call array_sort function and then strip the
'_' off the keys again.
i.e.
Doesn't work:
Before:6=5,3=1,5=4,7=1,1=3,2=1,4=1
After:0=5,1=4,2=3,3=1,4=1,5=1,6=1
Works:
Before:_6=5,_3=1,_5=4,_7=1,_1=3,_2=1,_4=1
After:_6=5,_5=4,_1=3,_2=1,_3=1,_4=1,_7=1
--
http://www.php.net/manual/en/function.array-multisort.php
http://master.php.net/manage/user-notes.php?action=edit+31254
http://master.php.net/manage/user-notes.php?action=delete+31254
http://master.php.net/manage/user-notes.php?action=reject+31254