PHP Questions Home | Register | Login
Categories
Arrays
Files
Forms
Creating PDFs
PHP Errors
Functions
Images
MySQL
Numbers
Others
Strings
Website
Unanswered

PHP Forums
Forums Index
MySQL Forum
PHP Forum
Flash/Actionscript
Javascript
Web design

More PHP
PHP Functions
Top Questions
Ask a Question
PHP Interview Questions
PHP Jobs
Ecommerce
IT Questions
Business Websites

Sponsors

sponsor ad
My Salary
PHP Developer Salary
Advertise Here

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

How can I loop through the members of an array?

How to point internal pointer to first element of an array?

I have an array of a hundred or so lines, each line has data with "|" separated values. I need to scan through this array, and select the line whose first 5 characters matches a text string. Any ideas or questions?

How can I create an array of numbers easily?

what is a array?



Custom Search