Conditional statement in PHP
PHP lets programmers evaluate different conditions during of a program and take decisions based on whether these conditions evaluate to true of false.
These conditions, and the actions associated with them, are expressed by means of a programming construct called a conditional statement.
PHP supports different types of conditional statements
- The if Statement : In if Statements Output will appear when only Condition must be true.
- The if-else Statement : if-else statements allows you to display output in both the condition(if condition is true display some message otherwise display other message).
- The if-elseif-else Statement : The if-else-if-else statement lets you chain together multiple if-else statements, thus allowing the programmer to define actions for more than just two possible outcomes.
- The switch Statement :The switch statement is similar to a series of if statements on the same expression.