Answers for "how to make a loop that adds numbers to a variable in php"

PHP
0

how to make a loop that adds numbers to a variable in php

<?php

$start = 1;
$end = 10;

$sum = 0;
for ($i = $start; $i <= $end; $i++) {
    $sum += $i;
}

echo "Sum from " . $start . " to " . $end . " = " . $sum;
Posted by: Guest on December-02-2020

Code answers related to "how to make a loop that adds numbers to a variable in php"

Browse Popular Code Answers by Language