Page 1 of 1

Dinamic array

Posted: Tue May 12, 2009 8:07 pm
by gastoncs
Hi all, I want to create an array that can be generates dynamically, here is the example

I am going to loop this numbers

3
4
2
3
4
1
4

I dont know in advance how many numbers will be.

this is the result I want: $result=array(1=>1,2=>1,3=>2,4=>3)

I want to have the key and the count of each number.

Thanks in advance

Re: Dinamic array

Posted: Tue May 12, 2009 8:29 pm
by gastoncs
I just found out I can use this function : array_count_values($array);