Re: Count how many times a value occurs in an array [message #179276 is a reply to message #179270] |
Thu, 27 September 2012 22:26 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 9/27/2012 1:14 PM, Ryan wrote:
> 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.
>
If it's coming from a database, just let the database gives you the counts.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|