Home> php教程> php手册> body text

php array_count_values 用法详解

WBOY
Release: 2016-06-21 08:53:14
Original
1357 people have browsed it

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

说明

array array_count_values( array$input)

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

Example #1array_count_values()例子

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

上例将输出:

Array
(
[1] => 2
[hello] => 2
[world] => 1
)
Copy after login



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!