Control Structures - Loops and Conditional Statements in PHP, write an original code using one of the control structure statements and submit it as your programming assignment.
Answer:
A control structure is a block of code that decides the execution path of a program depending on the value of the set condition.
Control Structure: for loop
Syntax:
for (init counter; test counter; increment counter)
{
code to be executed for each iteration;
}
Program: control.php : Below is the program to display even number between 1 to 10.
<?php
//creating for loop
for($i=1; $i<10; $i++)
{
if($i%2==0)//checking if value of i is even
echo" $i"; //display value of
i
}
?>
in above program for loop is used as control structure which initialize to $i = 0, we test condition for $i<10 and we increment value of $i by one. In for loop body conditional statement is used for checking value of $i, if value is even we display the value of $i.

Control Structures - Loops and Conditional Statements in PHP, write an original code using one of...