I have this multi-dimentional array:
Array
(
[0] => Array
(
[name] => lorem
[id] => 1
[type] => Q1
[q1] => 39.55
[q2] => 0
)
[1] => Array
(
[name] => lorem
[id] => 1
[type] => Q2
[q1] => 0;
[q2] => 39.55
)
[2] => Array
(
[name] => lorem
[id] => 1
[type] => Q1
[q1] => 39.55
[q2] => 39.55
)
[3] => Array
(
[owner_name] => name
[id] => 2
[type] => Q1
[q1] => 39.55
[q2] => 0
)
)
I want to combine all the items in an array with the same id and total all the q1 and q2 in the same owner only in the same type creating a new array structure:
Array
(
[0] => Array
(
[name] => lorem
[id] => 1
[Q1_total = > 79.1
[q2_total] => 79.1
)
[1] => Array
(
[owner_name] => name
[id] => 2
[type] => Q1
[Q1_total] => 39.55
[Q2_total] => 0;
)
)