Question: In the code below, assuming the $hour variable has been defined earlier on in the code, when is the else block executed? if ( $hour

In the code below, assuming the $hour variable has been defined earlier on in the code, when is the else block executed?
if ($hour <12){
echo "Good morning";
} elseif ($hour <18){
echo "Good afternoon";
} elseif ($hour <22){
echo "Good evening";
} else {
echo "Good night";
}
Group of answer choices
It is never executed
Only if none of the conditions in the if statement and elseif statements match
It is always executed

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!