note 19856 deleted from function.array-multisort by aidan
| From: | aidan@php.net | Date: | Sun, 03 Oct 2004 10:59:28 +0000 |
| Subject: | note 19856 deleted from function.array-multisort by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-77816@lists.php.net to get a copy of this message | ||
Note Submitter: richard at richardhayes dot net
----
EXAMPLE: You have two arrays where one has results from a test and the other names of the
participants and you need to graph these results in descending order, but keeping the name and score
relationship in tact.
<?
$scores=array(90, 10, 70, 100);
$participants=array("liam","val","john","richard");
array_multisort($scores,SORT_DESC,$participants);
# would now produce:
# $scores[0]=100; $participants[0]="richard";
# $scores[1]=90; $participants[1]="liam";
# etc..
?>