FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Count how many times a value occurs in an array
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Count how many times a value occurs in an array [message #179263] Thu, 27 September 2012 06:25 Go to previous message
Ryan is currently offline  Ryan
Messages: 15
Registered: July 2012
Karma:
Junior Member
I have an array lets say for example:

$my_array = array('1', '1', '2', '3', '1', '3', '2');

I want a listing of each value in the array and how many times it occurs for in this case it would look like this

array ('1' => 3, '2' => 2, '3' => 2)

jw if ph has a build in function to make this easy of am I going to have to roll my own by looping though the array?
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Only Allow exec in CLI
Next Topic: Re: FEDEX Shipping
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 09 17:25:10 GMT 2024

Total time taken to generate the page: 0.05408 seconds