<?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
Write a PHP script that checks if a given string is a valid email address. |
how to get response status in api using curl php? |
Write a PHP script that parses JSON data and displays specific information. |
Create a PHP script that prints the current date and time. |
How to reverses a given string using PHP. |
How to convert a temperature from Celsius to Fahrenheit using php. |
Write a PHP function that throws a custom exception if a condition is not met. |
Create a PHP script that calculates the average of an array of numbers. |