IF ELSE Statements

Chapter 6 #113 - Martha's CIS 52

ASSIGNMENT/EXPLANATION

The ifelse() statement adds the possibility of executing code when the if statement evaluates to false.

Exercise

I'm in a sad mood.

CODE

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