PHP - array_count_values
Trieda
Metóda - array_count_values
(PHP 4, PHP 5, PHP 7)
Returns an associative array containing counts of individual items in a given array.
Procedurálne
- function array_count_values () : array
Parametre
ŽiadneMávratovej hodnoty
Vracia: array
Returns an associative array, in which the keys are the counted items and the values are the item counts.
Príklady
This example outputs: Array (
[1] => 1,
[hello] => 2,
[world] => 1 )
<?php
$array = array("hello", "world", "hello", 1);
var_dump(array_count_values($array));
Súvisiace manuály
- function array_unique (array $array, int $sort_flags = SORT_STRING) : array
- function array_values (array $array) : array
- function count (mixed $array_or_countable, int $mode = COUNT_NORMAL) : int
