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
Re: Count how many times a value occurs in an array [message #179272 is a reply to message #179270] Thu, 27 September 2012 17:43 Go to previous messageGo to previous message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma:
Senior Member
Am 27.09.2012 19:14, schrieb Ryan:
> On Thursday, September 27, 2012 9:19:08 AM UTC-7, M. Strobel wrote:
>> Am 27.09.2012 13:08, schrieb Erwin Moller:
>>
>>> On 9/27/2012 12:48 PM, Captain Paralytic wrote:
>>
>>>> On Sep 27, 7:25 am, Ryan <rbile...@gmail.com> wrote:
>>
>>>> >
>>
>>>> > 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?
>>
>>>>
>>
>>>> Care to explain what the above is supposed to mean?
>>
>>>>
>>
>>>
>>
>>> jw probably means: Just wondering
>>
>>> ph probably means PHP
>>
>>>
>>
>>
>>
>> I hope (for him) the OP does not program the same way he is writing.
>>
>>
>>
>> /Str.
>
> Oh so will arra_count_values not work? lol that's what I get for typing tired. Fortunately for me my IDE will highlight any errors lol.
>
> On a more serious note though I have noticed one limitation. It will no go into sub arrays. So when I query my DB it will actually come up like this
>
> array (array(1), array(1), array (2)) ect. So what would be the best way to deal with this, is there a way to go though and clean it up by removing the nested arrays and replacing them with integers or even a literal string would work for me.
>
> I suppose if all else fails I could just loop though the primary array and implode each sub array.

Yes you get an array of arrays from a database query.

PHP has a ton of functions... let's see... I would use array_walk_recursive().

Be careful with call-by-reference, it is not allowed in the newest PHP versions.

/Str.
[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 Nov 28 02:31:17 GMT 2024

Total time taken to generate the page: 0.04330 seconds