使用array_count_values函数可以找出数组中相同值出现的次数,array_count_values用法如下:array_count_values — 统计数组中所有的值出现的次数array array_count_values ( array $input)array_count_values() 返回一个数组,该数组用 input 数组中的值作为键名,该值在:input 数组中出现的次数作为值input:统计这个数组的值返回值:返回一个关联数组,用 input数组中的值作为键名,该值在数组中出现的次数作为值。示例:1234<?php$array = array(1, "hello", 1, "world", "hello");print_r(array_count_values($array));?>以上例程会输出:123456Array([1] => 2[hello] => 2[world] => 1)需要取出哪个值的次数,就在返回的数组中获取对应的key值即可,例如示例中array_count_values($array)['hello']就可以取出数组中hello的个数。