PHP Code Snippet Library

 +library
+ Arrays (5)
+ Change Case
+ Count Array Values
+ Dump Highlighted
+ Print Nice
+ test some special chars
+ COM for Windows (2)
+ ClibPDF (1)
+ Image (7)
+ LDAP (9)
+ MySQL (12)
+ Regular Expressions (3)
+ String Manipulation (12)
+ Time and Date (6)
 +Snippet Options
+   Printer Friendly
 +General Options
+   Library Home
+   PHP-CSL Credits
+   PHP-CSL License
+   PHP Resource Links
+   Log in
Syntax for: Arrays / Count Array Values
<?php
$array 
= array (1"hello"1"world""hello");
print_r(array_count_values ($array));
?>
 
Description for: Arrays / Count Array Values
Returns and array with a count of all the values:

Array
(
[1] => 2
[hello] => 2
[world] => 1
)

 
Powered by: PHP Code Snippet Library V0.8