In PHP, decision making statements or conditional statements are the statements which are used to deciding the order of execution of statements based on certain conditions or perform different types of actions based on different actions.
Basically, decision making statements are used while making a decision. For example - If statement executes a code only upon a specific condition is true.
Different types of decision making statements in PHP such as IF statement, IF Else statement,IF Elseif statement, switch case statement etc.
Syntax
This will produce following result
We can enhance any decision making process by adding an else statement to the if construction. This allows to run one block of code if an expression is true and a different block of code if the expression is false.
Syntax
This will produce following result
We can even combine the else statement with another if statement to make as many alternative choices as we like:
Syntax
This will produce following result