..


Sponsored Links

array_count_values

Array_count_values ​​function returns a new array where the keys are the values ​​of the original array and the values ​​are the numbers of occurrences (ie the number of times the original value is in the array).

The function in question has only one parameter, the array on which to operate. Here's an example:






 $ A = array ("Mouse", "Cat", "Dog", "Mouse", "Dog", "Dog");







 print_r (array_count_values ​​($ a));



The output of the code above will be:
 



 Array (



  



 [Cat] => 1



  



 [Dog] => 3



  



 [Mouse] => 2







 )

 

In the same category ...
E-Learning
Linux (Course) Linux (Course)
Complete guide to open-source system. From 49 €.
MySQL (Course) MySQL (Course)
Management of open-source database. From 39 €.
PHP (Course) PHP (Course)
Full course for creating dynamic Web sites. From 49 €.
Sponsored Links