数组 函数
php 手册 | 脚本学堂 | 脚本编程 | 网站编程 | 系统管理 | 服务器配置 | 数据库管理 | Php教程 | python教程 | 正则表达式 | 批处理脚本 | Centos教程 | Linux基础教程

array_count_values

(PHP 4, PHP 5)

array_count_values统计数组中所有的值出现的次数

说明

array array_count_values ( array $input )

array_count_values() 返回一个数组,该数组用 input 数组中的值作为键名,该值在 input 数组中出现的次数作为值。

Example #1 array_count_values() 例子

<?php
$array 
= array(1"hello"1"world""hello");
print_r(array_count_values ($array));
?>

上例将输出:

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

参见 count()array_unique()array_values()count_chars()


数组 函数
php 手册 | 脚本学堂 | 脚本编程 | 网站编程 | 系统管理 | 服务器配置 | 数据库管理 | Php教程 | python教程 | 正则表达式 | 批处理脚本 | Centos教程 | Linux基础教程