PHP If Else
PHP if else statement is used to test condition. There are various ways to use if statement in PHP.
- if
- if-else
- if-else-if
- nested if
PHP If Statement:
PHP if statement is executed if condition is true.otherwise false
Syntax
Flowchart
Example
Output:
12 is less than 100
PHP If-else Statement:
the if-else condition is the if part is true to execute the part .
the condition is false to go into else part
PHP if-else statement is executed whether condition is true or false.
Syntax
Flowchart
Example
Output:
12 is even number