Hi I’ve got the following array:
Array
(
[20] => Array
(
[condomino] => 20
[anagrafica] => Alessandro Rossi
[immobile] => Immobile 1A
[paid] => 150.00
[01/01/2021] => Array
(
[to_pay] => 83.35
[scaduta] => 1
)
[01/05/2021] => Array
(
[to_pay] => 83.33
[scaduta] => 1
)
[25/12/2021] => Array
(
[to_pay] => 83.33
[scaduta] => 1
)
)
)
I need to achieve the following array:
Array
(
[20] => Array
(
[condomino] => 20
[anagrafica] => Alessandro Rossi
[immobile] => Immobile 1A
[paid] => 150.00
[01/01/2021] => Array
(
[to_pay] => 83.35
[scaduta] => 1
[left_to_pay] => 0
)
[01/05/2021] => Array
(
[to_pay] => 83.33
[scaduta] => 1
[left_to_pay] =>16.68
)
[25/12/2021] => Array
(
[to_pay] => 83.33
[scaduta] => 1
[left_to_pay] =>83.33
)
)
)
So basibally I need to subtract each to_pay value from paid value and then use what is left from each operation to carry on into the next subarray. Can anyboby please give me some help or point me into the right direction? Many thanks