I think I understand you problem, give this ago :)
<?php
// Input array
$array = array(
array('a' => 10),
array('b' => 20),
array('c' => 20),
array('c' => 15)
);
// Create a new array for storage
$newArray = array();
// Loop through each item
foreach($array as $item) {
// Find the array keys of the item (['a']...['c'], etc)
$keys = array_keys($item);
// If the keys count is what we are expecting
if (count($keys) == 1) {
// Check if this value has already been processed
if (array_key_exists($keys[0], $newArray)) {
// If so then increase the count and add the value
$newArray[$keys[0]]['count']++;
$newArray[$keys[0]]['value'] += $item[$keys[0]];
} else {
// Other wise add this item to the new array
$newArray[$keys[0]] = array(
'count' => 1,
'value' => $item[$keys[0]]
);
}
}
}
// Average out the values and format into the required output
$outputArray = array();
foreach($newArray as $key => &$value) {
$outputArray[] = array($key => ($value['value'] /= $value['count']));
}
// Output array
var_dump($finalArray);