$result = array_fill_keys(array_keys($data),array());
foreach ($data as $data_key => $data_item) {
foreach ($data_item as $key => $values) {
foreach ($values as $value_key => $value_val) {
if (!isset($result[$data_key][$value_key])) {
$result[$data_key][$value_key] = (object)array();
}
$result[$data_key][$value_key]->$key = $value_val;
}
}
}