PHP Conditions

If/Else Condition Example

The score is 85, so the student passed.

Switch/Case Condition Example

Monday is the beginning of the school week.

Explanation

Conditions allow a PHP program to make decisions and run different code based on whether an expression is true or false. An if/else statement chooses between two paths. A switch statement compares one value with several cases, runs the matching case, and uses default when none of the listed cases match.