I have already try like this
<?php
echo '<pre>';
$arrayName = array(1,2,3,4,5,6,2,3,1 );
$arr= array_count_values(array_column($arrayName,'5'));
print_r($arr);
?>
I just want to counting of repeated value
Why are you using array_column if you only want to count repeated values you can do this
<?php
echo '<pre>';
$arrayName = array(1,2,3,4,5,6,2,3,1 );
$arr= array_count_values($arrayName);
print_r($arr);
?>
if you want count the values
$arrayName = array(1,2,3,4,5,6,2,3,1 );
$arr =array_count_values($arrayName);
print_r($arr);
This script counts the amount of each value.
<?php
echo '<pre>';
$arrayName = [1,2,3,4,5,6,2,3,1];
$arr = [];
foreach ($arrayName as $item) {
if (empty($arr[$item]))
$arr[$item] = 0;
$arr[$item] += 1;
}
print_r($arr);