Lect 4
Lect 4
Lecture # 4
Control Structure
• In this chapter we have two different types of structures.
Conditional Structure
Iterative Control Structure.
• Conditional structure describe the if-then, if-then-else, if-then-else- if-then-
else, and switch statements. These structure enable you to make decisions
based on single variables or collections of variables.
PHP - The if Statement
• <?php
$t = date("H");
• The if statement is used to
execute some code only if a if ($t < "20") {
specified condition is true. echo "Have a good day!";
• Syntax: }
?>
if (condition) {
code to be executed if condition is true;
}
• <?php
PHP - The if...else Statement
$t = date("H");