PHP array_count_values() 函数
PHP 教程
· 2019-01-22 05:58:11
实例
统计数组中所有值出现的次数:
<?php
$a=array("A","Cat","Dog","A","Dog");
print_r(array_count_values($a));
?>
$a=array("A","Cat","Dog","A","Dog");
print_r(array_count_values($a));
?>
定义和用法
array_count_values() 函数用于统计数组中所有值出现的次数。
语法
array_count_values(array)
| 参数 | 描述 |
|---|---|
| array | 必需。规定需要统计数组中所有值出现次数的数组。 |
技术细节
| 返回值: | 返回一个关联数组,其元素的键名是原数组的值,键值是该值在原数组中出现的次数。 |
|---|---|
| PHP 版本: | 4+ |
点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html
Delivering Happiness
Tony Hsieh / Grand Central Publishing / 2010-6-7 / USD 27.00
http://www.deliveringhappinessbook.com/ The visionary CEO of Zappos explains how an emphasis on corporate culture can lead to unprecedented success. Pay new employees $2000 to quit. Make custome......一起来看看 《Delivering Happiness》 这本书的介绍吧!