I\'ve been working on this for a couple days now... and still haven\'t been able to achieve my desired results. Any help would on this would be greatly appreciated... thank
If you are using PHP >= 5.5, you can use array_column(), in conjunction with array_count_values():
$colors = array_count_values(array_column($log, 0));
$materials = array_count_values(array_column($log, 1));
See demo
Or, if you're not using PHP >= 5.5, this will work in PHP 4, 5:
$colors = $materials = array();
foreach ($log as $a){
$colors[] = $a[0];
$materials[] = $a[1];
}
$colors = array_count_values($colors);
$materials = array_count_values($materials);
See demo 2
Click here for sample use case that will work with either method.