note 87888 added to function.array-multisort
| From: | Anonymous at osu1 dot php dot net | Date: | Mon, 29 Dec 2008 06:54:09 +0000 |
| Subject: | note 87888 added to function.array-multisort | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-148633@lists.php.net to get a copy of this message | ||
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!
----
Server IP: 140.113.54.119
Probable Submitter: 211.20.177.117
----
Manual Page -- http://www.php.net/manual/en/function.array-multisort.php
Edit -- https://master.php.net/note/edit/87888
Del: integrated -- https://master.php.net/note/delete/87888/integrated
Del: useless -- https://master.php.net/note/delete/87888/useless
Del: bad code -- https://master.php.net/note/delete/87888/bad+code
Del: spam -- https://master.php.net/note/delete/87888/spam
Del: non-english -- https://master.php.net/note/delete/87888/non-english
Del: in docs -- https://master.php.net/note/delete/87888/in+docs
Del: other reasons-- https://master.php.net/note/delete/87888
Reject -- https://master.php.net/note/reject/87888
Search -- https://master.php.net/manage/user-notes.php