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://www.codercto.com/courses/l/5.html
Computer Age Statistical Inference
Bradley Efron、Trevor Hastie / Cambridge University Press / 2016-7-21 / USD 74.99
The twenty-first century has seen a breathtaking expansion of statistical methodology, both in scope and in influence. 'Big data', 'data science', and 'machine learning' have become familiar terms in ......一起来看看 《Computer Age Statistical Inference》 这本书的介绍吧!