Forum und email

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));
?>

The printout of the above program will be:

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

count(), array_unique(), array_values(), count_chars() 참고.