Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

imyn's avatar
Level 1

data date

Hello, For a defined time interval I want to get the data and calculated it for each day then make the sum Do you have an idea how I can do this? thank you in advance

0 likes
12 replies
jlrdw's avatar

Have you heard of aggregate functions?

imyn's avatar
Level 1

yes but id didnt find the answer

imyn's avatar
Level 1
 <?php $TotalFan=0;$TauxPosts=0; ?>
            @foreach ($page['benches'] as $bench)
                <?php
            $TotalFan=$TotalFan+$bench->Total_fan;
                $taux=(($somme/$TotalFan)*100)+$bench->taux;
                ?>
            @endforeach
            <td>{{round($taux ,2)}}</td>

how can i do it here ?

imyn's avatar
Level 1

no i didnt need the sum but id like to calcule the sum for each day

imyn's avatar
Level 1

i dont need to calculate the number of hours , i need to get the value % of each day the do the sum ! hope that you undrestand me

Snapey's avatar

i don't understand you because I don't have a clue what the data looks like

imyn's avatar
Level 1

ok well, I will calculate the sum of interactions on a post for each day then I will sum up the interval of time I will choose ! Here I just did the calculate but I want to do the calculation for each day

imyn's avatar
Level 1

how i make the condition on the date

Please or to participate in this conversation.