I have an array of numbers and many repeat, how to list all items in order of maximum occurence?
To do this you will want to use the excellent built-in PHP function called array_count_values that saves the hassle of coding this yourself like you have to do in many other languages.
Again this is one of the great things about PHP, there is a function in place to do most common tasks so that you don't have to write the code yourself!
Here is more information on the use of array_count_values and a worked example:
http://www.php-questions.com/phpfaq/answer103
Comment on this Question and Answer >>>
ASK A QUESTION
More arrays PHP Questions
what is a array?How do I remove an element from an array without changing the index values for the rest of the array?
How do I reverse the order of the elements in an array?
Hi. i have a music samples website. in one table, id like a different sample to appear every time the page is refreshed. how do i acheve this? how can i alterate and retrieve these bloody mp3's? surely i can use a PHP script? thankyou
How can I sort a multi-dimensional array?
