PHP Conditions

Example 1: If/Else Statement

Age: 20

Result: You are an adult.

Example 2: Switch/Case Statement

Day: Wednesday

Result: Halfway through the week!

Explanation

An if/else checks something and runs different code depending on whether it's true or false. A switch compares one variable against several possible values. Each case is one possibility, and break stops it from checking further once it finds a match