Home » Programming » php » PHP if else Statements

PHP if else Statements

There are few conditional statements in PHP that is been used for putting different conditions. All the statements are as follows:
1. if statement
It execute that code only if the situation is true otherwise not.
Syntax:

Example:

Result
PHP!

2. if else statement

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

Syntax:

Example:

Result:
PHP!

3. if…elseif….else statement
Sometime first condition get false then to check or test another condition we use this statement.

Syntax:

Example:

Result:

Please follow and like us:
error

Leave a comment

Your email address will not be published.