note 83972 deleted from function.array-count-values by mgf
| From: | mgf@php.net | Date: | Thu, 17 Jul 2008 11:38:45 +0000 |
| Subject: | note 83972 deleted from function.array-count-values by mgf | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-141616@lists.php.net to get a copy of this message | ||
Note Submitter: Robert K S
Reason: 2
----
Follow an array_count_values() call with a call to array_keys() to give an array sorted by the
frequency of its values (with redundancy automatically removed--no need for a call to unique()).
$namearray = array('Adam', 'Bill', 'Carl', 'Adam',
'Bill', 'Dan', 'Adam');
$newarray = array_count_values($namearray);
$sortedarray = array_keys($newarray);