note 87890 deleted from function.array-multisort by danbrown
| From: | danbrown@php.net | Date: | Mon, 29 Dec 2008 18:55:15 +0000 |
| Subject: | note 87890 deleted from function.array-multisort by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-148646@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
a example for my previous note:
1. crateing array $idol, print_r as:
Array
(
[0] => Array
(
[0] => 97/1/12
[1] => snoopy
)
[1] => Array
(
[0] => 97/1/1
[1] => doraemon
)
[2] => Array
(
[0] => 96/11/24
[1] => doraemon
)
2. creating 2 column-array: idol_name & idol_dob:
idol_name, print_r as =
Array
(
[0] => snoopy
[1] => doraemon
[2] => doraemon
)
idol_dob, print_r as =
Array
(
[0] => 97/1/12
[1] => 97/1/1
[2] => 96/11/24
)
3. I intend to do SQL's 'order by idol_name desc, idol_birth asc', so I issue
command:
array_multisort($idol_name, SORT_DESC,
$idol_dob, SORT_ASC,
$idol);
4. Since the manual said it will key the key association of arrays, I expect $idol becomes this:
Array
(
[0] => Array
(
[0] => 97/1/12
[1] => snoopy
)
[2] => Array
(
[0] => 96/11/24
[1] => doraemon
)
[1] => Array
(
[0] => 97/1/1
[1] => doraemon
)
)
5. However, it prints out this:
Array
(
[0] => Array
(
[0] => 97/1/12
[1] => snoopy
)
[1] => Array
(
[0] => 96/11/24
[1] => doraemon
)
[2] => Array
(
[0] => 97/1/1
[1] => doraemon
)
)
6. note the key association of $idol, there're reassigned!
What's wrong with the manual? or what's wrong with my understanding?