<?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
How to reverses a given string using PHP. |
Write a PHP script that generates and displays a simple multiplication table for the numbers 1 to 5. |
Write a PHP script that sets a cookie with user preferences and retrieves it on subsequent visits. |
how to get current lat and lng from ip address using google map api in php? |
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. |
Create a simple PHP script that calculates the sum of all even numbers between 1 and 10. |
Write a PHP script that checks if a given string is a valid email address. |
