i have a foreach and the code below returns to me the values (int) that you can see from Screenshot 1
foreach ($getMatches->participants as $data) {
$count = ($data->id);
echo '<pre id="json">'; var_dump($count); echo '</pre>';
}
So, i want to count how many times the same value appears. In this case : Value 98 : 2 times ; Value 120: 3 times , etc.
I've tried to convert my $count variable to an array and use array_count_values like the code below , but with no success. As you can see in screenshot 2 the value 98 is returning only 1 instead of 2, the value 120 is returning only 1 instead of 3 , etc
foreach ($getMatches->participants as $data) {
$count = array($data->id);
echo '<pre id="json">'; var_dump(array_count_values($count)); echo '</pre>';
}