Count Frequency Of Each Element in Array using PHP

array_count_values function

<?php

$data = [10, 'test', 'test', 10, 'Hi', 'test'];
$result = array_count_values($data);

print_r($result);

Leave a Comment

Cancel reply

Your email address will not be published.