I have an array with small example below
Array (2)
system => Array (1)
system_id => 3
proc => Array (4)
proc_id => 5
proc_or => 1
proc_owner => 7751
results => Array (7)
0 => Array (5)
process_id => 101
process => 1335
process_name => xa
process_owner => xo
rating => 67.554
1 => Array (6)
process_id => 122
process => 1335
process_name => xa
process_owner => xo
rating => 33.554
proc_rel => xf
2 => Array (5)
process_id => 101
process => 1227
process_name => xd
process_owner => xa
rating => 123.78
3 => Array (8)
process_id => 101
process => 1291
process_name => xa
process_owner => xo
rating => 64.241
proc_rel => xf
proc_rel_id => 1474
proc_rel_owner => xm
I need to be able to organise this so that it contains only unique process_id values, so results 2 and 3 would be removed and the rating for that remaining unique id is the sum of all ratings for the records with that id so the results 0 rating id would become the sum of results 0 2 and 3.
There are thousands of records so its not practyical to do it without some sort of automated loop
I was thinking of maybe creating a new array and as its being processed
If the process_id is not in new array add it and all related data If the process id is already in the array just add(+) the value of rating to the existing value.
I have tried to adapt a couple of loops that ive found but they dont seem to work properly.
Not sure if this is the way to go and Im not sure how to do it anyway so any suggestions greatly appreciated.