php array_count_values 函数
array_count_values( PHP 4中, PHP 5中)
array_count_values -计数所有数组值相同和
描述
阵列array_count_values (数组$输入)
array_count_values()返回一个数组使用的值,输入数组的键和其频率的投入的价值。
参数
输入
数组的值来计算
返回值
返回一个关联数组的值输入的关键和伯爵的价值。
错误/例外
全E_WARNING每个元素是不是字符串或整数。
实例
例如# 1 array_count_values()的例子
<?php $array = array(1, "hello", 1, "world", "hello"); print_r(array_count_values($array)); ?>
The above example will output:
Array ( [1] => 2 [hello] => 2 [world] => 1 )
教程地址:http://www.phprm.com/function/33baa81d7406cc7a4f22667ca499e3dc.html
欢迎转载!但请带上文章地址^^