Function to find out the number of occurrence elements in an array -PHP

<?php
 $testArray=array("Value1","Value1","Value1","Value2");
 print_r(array_count_values($testArray));
 //Array ( [Value1] => 3 [Value2] => 1 )
?>
Share

Leave a Reply

Your email address will not be published. Required fields are marked *