'How to add two array key values and return as a new key in PHP

I have an array($data) like this.

Array
(
    [0] => Array
        (
            [PID] => 1
            [USER_NAME] => JOHN
            [JOINED_DATE] => 2022-01-31
            [JOINED_VALUE] => 23233.80
            [TOPUP_AMOUNT] => 58000.00
            [TOTAL_EXPENSES] => 3114.41
        )
.....

I need to get a new key called TOTAL_BALANCE and it should get as follows,

TOTAL_BALANCE=JOINED_VALUE+TOPUP_AMOUNT+TOTAL_EXPENSES

Final output should look as follows,

Array
    (
        [0] => Array
            (
                [PID] => 1
                [USER_NAME] => JOHN
                [JOINED_DATE] => 2022-01-31
                [JOINED_VALUE] => 23233.80
                [TOPUP_AMOUNT] => 58000.00
                [TOTAL_EXPENSES] => 3114.41
                [TOTAL_BALANCE] => 78119.39
            )
    .....

Can someone help me to achieve this?

Here is my try, but I am not sure this is correct or not.

$r = [];
$keys = array_keys($key1+$key2);
foreach($keys as $v){
  ??
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source