Jump to content

Counting duplicate results in an array


Michan

Recommended Posts

Hi,

 

I'm stuck with an array. How would I count duplicate results in array?

 

[0] => red
[1] => blue
[2] => red
[3] => blue
[4] => red

 

Is there a way I can easily count these results so it returns:

 

[0] => red(3)
[1] => blue(2)

 

..or something similar?

 

Thanks in advance!

Link to comment
https://forums.phpfreaks.com/topic/93804-counting-duplicate-results-in-an-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.