i have an array. i want to check if there is duplicate FEE and if there is i want to sum up all the values with the same FEE COLUMN.
[12] => Array
(
[type] => Other Miscellaneous Fees
[fee] => 158
[amount] => -22.56
[code] => COL_AUDIO
[feedesc] => COLLEGE AUDIO VISUAL FEE
)
[13] => Array
(
[type] => Other Miscellaneous Fees
[fee] => 158
[amount] => -297.86
[code] => COL_AUDIO
[feedesc] => COLLEGE AUDIO VISUAL FEE
)
[14] => Array
(
[type] => Other Miscellaneous Fees
[fee] => 182
[amount] => -40.00
[code] => STRAP
[feedesc] => ID STRAP
)
[15] => Array
(
[type] => Other Miscellaneous Fees
[fee] => 177
[amount] => -105.00
[code] => PRISAA
[feedesc] => PRISAA
)
desired output, i want it to store in a new array. ive tried playing with array_sum and array colum. but it will sum all the fields. thanks
array_sum(array_column($feesArray, 'fee'));
[0] => Array
(
[type] => Other Miscellaneous Fees
[fee] => 158
[amount] => -320.42
[code] => COL_AUDIO
[feedesc] => COLLEGE AUDIO VISUAL FEE
)
[1] => Array
(
[type] => Other Miscellaneous Fees
[fee] => 182
[amount] => -40.00
[code] => STRAP
[feedesc] => ID STRAP
)
[2] => Array
(
[type] => Other Miscellaneous Fees
[fee] => 177
[amount] => -105.00
[code] => PRISAA
[feedesc] => PRISAA
)