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:
ASK A QUESTION
More arrays PHP Questionsi need to store a multi-dimensioned array into a file. there is plenty of info. on creating md-arrays but i cant find anything on writing a md-array to a file.
How can I check if a value is already in an array?
I want to invert my array, can I do this?
How do I generate an associative array like Jan => 10, Feb =>20 etc from a mysql table of 2 columns, month and val ?
How do I reverse sort the members of an array?