Answer the question
In order to leave comments, you need to log in
How to calculate the sum of all numbers?
There is a code that displays numbers. Can you tell me how to display only the sum of these numbers?
<?php foreach (get_payment_system('invest') as $item) { ?>
<?php echo format_currency(login_profit($login, $item['value']), $val) . ' ' . html($valu); ?>
<?php } ?>
Answer the question
In order to leave comments, you need to log in
Well, something like this:
<?php
$sum = 0;
foreach (get_payment_system('invest') as $item) {
$sum += $item['value'];
}
echo $sum;
?>
Take out and declare the variable $sum=0 for the loop above, and in the loop add to this variable the values $sum += here are your numbers
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question