PHP Conditional Statement - php server -

PHP Conditional Statement


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

  1. The if Statement
  2. In if Statements Output will appear when only Condition must be true.

  3. The if-else Statement
  4. if-else statements allows you to display output in both the condition(if condition is true display some message otherwise display other message).

  5. The if-elseif-else Statement
  6. 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.

  7. The switch Statement
  8. The switch statement is similar to a series of if statements on the same expression.