IF Statements

Chapter 6 #112 - Martha's CIS 52

ASSIGNMENT/EXPLANATION

PHP provides many ways to make web pages dynamic. Flow Control Functions allow scripts to evaluate conditions, and to alter their behavious accordingly. The most basic of these is the if statement. "The if statement evaluates an expression found between parentheses - if this statement results in a true value, the statement is executed. Otherwise, the statement is skipped entirely."

Exercise

Hooray, I'm in a good mood!

CODE

$mood = "happy";
if ($mood == "happy") {
echo "Hooray, I'm in a good mood!";
}