X
HOME HTML5 CSS3 JAVASCRIPT SQL PHP5 JQUERY ANGULAR BOOTSTRAP3 XML MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

PHP array_count_values() Function

PHP Array Reference PHP Array Reference

Example

Count all the values of an array:

<?php
$a=array("A","Cat","Dog","A","Dog");
print_r(array_count_values($a));
?>

Run example »

Definition and Usage

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


Syntax

array_count_values(array)

Parameter Description
array Required. Specifying the array to count values of

Technical Details

Return Value: Returns an associative array, where the keys are the original array's values, and the values are the number of occurrences
PHP Version: 4+


PHP Array Reference PHP Array Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook