Tutorials for PHP “if elseif else” Condition

What is “The if...elseif...else” Statement“?

The special Statement (if…elseif…else) is used to combine multiple Statements (if…else). The if-else-if-else statement allows you to combine multiple If-else statements, allowing the compiler to specify behaviors with more than two possible outcomes.

if (condition) {
  code to be executed if this condition is true;
} else if (condition) {
  code to be executed if first condition is false and this condition is true;
} else {
  code to be executed if all conditions are false;
}
PHP If Else - javatpoint

Example1:- If this condition is true!

Output:-

Example2:- If first condition is false and this condition is true!

Output:-

Example3:- If all conditions are false!

Output:-

Ashwani Kumar
Latest posts by Ashwani Kumar (see all)
Tagged : / / / / / / / / / /
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x