PHP Tutorial

A web server programming language.

PHP If...Else...Elseif

PHP if...else...elseif Statements

Conditional statements are used to perform different actions based on different conditions.

  • if statement: executes some code if one condition is true
  • if...else statement: executes some code if a condition is true and another code if that condition is false
  • if...elseif...else statement: executes different codes for more than two conditions

Try It Yourself

Edit the code below and click Run to see the result live.

Source Code
Result
Topics