If Elseif Statement In PHP
if...else Statement
- The if a statement is quite basic because in If the statement output will display when condition must be true if condition is false it display nothing(blank).
- But if-else statements allows you to display output in both the condition(if condition is true display some message otherwise display other message).
You can enhance the decision making process by providing an alternative choice through adding an else statement to the if statement. The if...else statement allows you to execute one block of code if the specified condition is evaluated to true and another block of code, if it is, evaluated to false. It can be written, like this:

Syntax
if (condition) {
code to be executed if condition is true;
} else {
code to be executed if condition is false;
}
The example below will output "Have a good day!" if the current time is less than 20, and "Have a good night!" otherwise:
The if...elseif...else Statement
The if...elseif...else a special statement that is used to combine multiple if...else statements.
Syntax
if(condition){
// Code to be executed if condition is true
} elseif(condition){
// Code to be executed if condition is true
} else{
// Code to be executed if condition is false
}
The Ternary Operator
The ternary operator provides a shorthand way of writing the if...else statements. The ternary operator is represented by the question mark (?) symbol and it takes three operands: a condition to check, a result for ture, and a result for false.
