PHP Programing language

array_count_values() Function in PHP
Previous Home Next

array_count_values()

The array_count_values() function counts all the values of an array.

Syntax:
array_count_values(array)

In above Syntax,"array" is used to count values.

Example:

<?php
$array = array("An","Apple","Mango","Apple","Mango");
print_r(array_count_values($array));
?>

Output:

Array ( [An] => 1 [Apple] => 2 [Mango] => 2 )

 

Previous Home Next