0
The array has the following structure below:
Array
(
    [0] => Array
        (
            [value] => 0
            [total] => 100
        )
    [1] => Array
        (
            [value] => 1
            [total] => 50
        )
    [2] => Array
        (
            [value] => 0
            [total] => 300
        )
    [3] => Array
        (
            [value] => 1
            [total] => 150
        )
)
The array that has the value index 0 will always be the total greater than the array that has the value index 1, so I need to scan and decrease the value of the total index of the array that has the value index 0 with the total of the array that has the value index 1, thus:
In the first loop make the calculation: $total = 100 - 50; $total = 50;
In the second loop make the calculation: $total = 300 - 150; $total = 150;
And at the end of all the loops have all the values that were subtracted summed and totaled, in the above example would be 200 (50, from the first loop + 150, from the second loop).
Does anyone know how to implement this logic in PHP to help me?