array_count_values() function in php
×


array_count_values() function in php

2185

array_count_values() function of PHP is used to count all the items of an array means it count the number of occurrence of a value into an array. It is an inbuilt function of PHP.

It returns an associative array which contains array values as keys and their occurrences as values.

Syntax
array_count_values ($array);

Here

$array represents an array.


Example:

<?php
$arr=array("Mango","Orange","Pear","Mango","Banana","Apple");
$new_arr=array_count_values($arr);
echo "<pre>";
print_r($new_arr);
?>

Output:




Best WordPress Hosting


Share:


Discount Coupons

Get a .COM for just $6.98

Secure Domain for a Mini Price



Leave a Reply


Comments
    Waiting for your comments