<?php
$sum = 0;
for ($i = 2; $i <= 10; $i += 2) {
$sum += $i;
}
echo "The sum of even numbers between 1 and 10 is: $sum";
?>
<?php
$sum = 0;
for ($i = 2; $i <= 10; $i += 2) {
$sum += $i;
}
echo "The sum of even numbers between 1 and 10 is: $sum";
?>
Related
Create a PHP script that prints the current date and time. |
Write a PHP script that calculates the factorial of a given number. |
Write a PHP script that calculates the sum of digits in a given number. |
Create a simple PHP script that calculates the sum of all even numbers between 1 and 10. |
Write a PHP script that calculates the factorial of a given number using an iterative approach. |
Create a PHP script that calculates and displays the area of a rectangle given its length and width. |
How to reverses a given string using PHP. |
Write a PHP script that parses JSON data and displays specific information. |