➤ The PHP if-else-if is a special statement used to combine multiple if...else statements.
So, we can check multiple conditions using this statement.
if (condition1){
//code to be executed if condition1 is true
} elseif (condition2){
//code to be executed if condition1 is false and condition2 is true
} elseif (condition3){
//code to be executed if condition2 is false and condition3 is true
....
} else{
//code to be executed if all given conditions are false
}
$x = 10;
if ($x > 0) {
echo "$x is positive\n";
} elseif ($x < 0 ) { // if $x equals negative number
echo "$x is negative!\n";
} else { // if $x = 0;
echo "$x is neither positive nor negative \n";
}