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: Thu Sep 19 16:50:39 GMT 2024

Total time taken to generate the page: 0.04819 seconds