[ACCEPTED]-How do i count same values in an array and store it to a variable?-loops
Accepted answer
see: array_count_values
Like:
$occurences = array_count_values($items);
print_r($occurences);
Output:
Array
(
[4] => 3
[2] => 3
)
Usage:
echo $occurences[4]; // outputs 3
0
You're probably looking for array_count_values() function.
0
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.