PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<array_combinearray_diff_assoc>
Last updated: Mon, 16 Jul 2012

array_count_values

(PHP 4, PHP 5)

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

说明

array array_count_values ( array input )

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

例子 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()




<array_combinearray_diff_assoc>
 Last updated: Mon, 16 Jul 2012
 
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://manual.phpv.net/
Last updated: Thu Jul 7 19:13:47 2005 CST