PHP If else & elseif

  • On: 4th Jun 2018
  • Category: PHP

Similar most programming languages, PHP also allows you to write code that does different actions based on the decisions of a logical or comparable test conditions at run time. That means you can create test conditions in the form of expressions that decides to either true or false and based on those results you can do specific actions. You can improve the decision making process by giving an alternative option through adding an else statement to the if statement. The if…else statement enables you to execute one section of code if the detailed condition evaluates to true and another section of code if it is decided to false.