How to withdraw the amount received from the records starting from the first day, adding the amount of the subsequent day within a month?

Daily is considered the sum of the values in the records of the day.
Don't understand how to withdraw the amount from the first day, adding the amount of the subsequent day within a month.
I am not going to take a month, let's take the last 5 days.
There are amounts per day:
1st day: 10
2nd day: 20
3rd day: 30
4th day: 10
5th day: 40
Need to get this:
1st day: 10 (or anything not added as of the 1st day)
2nd day: 30 (10+20)
3rd day: 60 (30+30)
4th day: 70 (60+10)
5th day: 110 (70+40)
Can I withdraw the total amount for these 5 days (110):
<?php
$args = array(
 'date_query' =--> array(
array(
 'after' => '2017-09-01',
 'before' => '2017-09-05',
 'inclusive' => true,
),
),
 'posts_per_page' => -1,
 'cat' => '2743',
);
$query = new WP_Query( $args );
$sum = 0;

while($query->have_posts()) {

$query->the_post();

 if( get_field("result") === 'Win') {
 $value = (float)get_field('koff') * (float)get_field('summa');
 $sum += $value;
 $out = sprintf( '%01.2 f', $value); 
 } elseif( get_field("result") === 'lose') {
 $value = '100.00';
 $sum -= $value;
 $out = sprintf( '%01.2 f', $value);
}
}
printf( "<p>Sum is: %01.2 f have.e.</p>", $sum );
?>

I have working piece of code. Is there some other conditions, but does not change the fact. I need to withdraw amount from the first day, adding the amount of the subsequent day within a month. Help!
June 14th 19 at 20:56
1 answer
June 14th 19 at 20:58
There is an array with the days ?
If is in days, just go through it foreach and add the values you need.
The sample code will not be able to lead? I'm not a programmer, this is a code understood for a very long time and with the help of local spec-s. - Meghan.Mr commented on June 14th 19 at 21:01
Show open array with data on it will show the code - Cristina_Beahan5 commented on June 14th 19 at 21:04
If you know more, as this array to.. - Meghan.Mr commented on June 14th 19 at 21:07

Find more questions by tags PHP