Skip to content Skip to sidebar Skip to footer

PHP get duplicate values count in an array

Reading Time: < 1 minute

If you want to get duplicate values count in an array,this method can be use easily.It will display array values all count.

$myArray = array("one", "two", "three","four","five","one","four");
$my_array_values = array_count_values($myArray);
while (list ($key, $val) = each ($my_array_values))
{
   echo "$key -> $val "."  times"."
"; }