I could write the code for you, but that feels wrong. Let me point you in the right direction.
Start here: http://php.net/manual/en/control-structures.foreach.php
You can iterate the array using a key-value foreach and use each array item, which is another array, to access the count and create your new array.
Good luck!
1
solved Create an array of array values by key [closed]