Bladephp: Now with 8+ codeigniter, php, and laravel project 8+ php project From $37/Month From Rs. 2499/Month

How to count same value in array using php

by
Category:php
php
How to count same value in array using php

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

The array_count_values() function counts all the values of an array.

$array = array("A","B","C","A","C");
print_r(array_count_values($array));

Output

Array ( [A] => 2 [B] => 1 [C] => 2 ) 

0 Comments


Html code work in comment box


Related Post