Combining array values in multilevel array
- by James Huckabone
I have an array like so:
array(
'a'=>array(
'a'=>3,
'f'=>5,
'sdf'=>0),
't'=>array(
'a'=>1,
'f'=>2,
'sdf'=>5),
'pps'=>array(
'a'=>1,
'f'=>2,
'sdf'=>3)
);
Notice how the sub-arrays are the same for each top-level array. If I wanted to, what's the easiest way to combine the sub-arrays so that I'm left with a one-dimensional array like:
array(
'a'=>5,
'f'=>9,
'sdf'=>8
);