PHP if else, else if Statements with examples

There are few conditional statements in PHP that is been used for putting different conditions. All the statements are as follows:

1. PHP if statement

It execute that code only if the situation is true otherwise not.
if statement Syntax:

Example:

Result
PHP!

2. PHP if else statement

If true then execute the result, but in case condition false then output will be other coded thing.

PHP if else Syntax:

Example:

Result:
PHP!

3. PHP if…else if….else statement

Sometime first condition get false then to check or test another condition we use this statement.

PHP if…else if….else Syntax:

Example:

Result: