PHP Conditions

If/Else Example

You are an adult.

Switch/Case Example

Today is Monday.

Explanation

Conditions allow a PHP program to make decisions based on whether something is true or false. An if/else statement chooses between two different sections of code. A switch statement compares one value against multiple cases and runs the matching case. The break statement stops PHP from continuing into the following cases.

Back to Activity 3