I have an array that looks like the following (I did a json_encode so it's easier to read on StackOverflow). I'm trying to get the highest color count based on number of colors. So for example single colors like Red has a count of 32 and White has a count of 31. Then I'd like to get the highest value which would be 32. And for dual colors I'd like to get back 4 since [White, Black] has the highest count among the dual colors. And for tri colors I'd like to get back 8 since they are all equal, etc.
[{
"colors" : "",
"count" : 55
}, {
"colors" : "[\"Red\"]",
"count" : 32
}, {
"colors" : "[\"Green\"]",
"count" : 32
}, {
"colors" : "[\"Blue\"]",
"count" : 32
}, {
"colors" : "[\"White\"]",
"count" : 31
}, {
"colors" : "[\"Black\"]",
"count" : 31
}, {
"colors" : "[\"White\",\"Black\",\"Red\"]",
"count" : 8
}, {
"colors" : "[\"Blue\",\"Red\",\"Green\"]",
"count" : 8
}, {
"colors" : "[\"White\",\"Blue\",\"Red\"]",
"count" : 8
}, {
"colors" : "[\"Blue\",\"Black\",\"Green\"]",
"count" : 8
}, {
"colors" : "[\"White\",\"Black\",\"Green\"]",
"count" : 8
}, {
"colors" : "[\"White\",\"Black\"]",
"count" : 4
}, {
"colors" : "[\"Black\",\"Green\"]",
"count" : 3
}, {
"colors" : "[\"White\",\"Red\"]",
"count" : 3
}, {
"colors" : "[\"Blue\",\"Green\"]",
"count" : 3
}, {
"colors" : "[\"Blue\",\"Red\"]",
"count" : 3
}
]
I'd like to retrieve these values in an array. The result would look like this:
$max_color_count = array(55, 32, 4, 8);
The 55 is from the one which has 0 colors, the 32 is from the single colors, the 4 is from dual colors, and the 8 is from tri colors.