note 87888 deleted from function.array-multisort by danbrown
| From: | danbrown@php.net | Date: | Mon, 29 Dec 2008 18:55:33 +0000 |
| Subject: | note 87888 deleted from function.array-multisort by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-148647@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
i tried this example:
<?php
// Obtain a list of columns
foreach ($data as $key => $row) {
$volume[$key] = $row['volume'];
$edition[$key] = $row['edition'];
}
// Sort the data with volume descending, edition ascending
// Add $data as the last parameter, to sort by the common key
array_multisort($volume, SORT_DESC, $edition, SORT_ASC, $data);
?>
In the manual it said: "maintains key association when sorting.". however, the array $data
seems to be reassigned the key association as subsequent subscripts, which aren't it's
original key association!