PHP if..Else..Elseif

PHP conditional statements are used to test the conditions. It supports different types of conditional statement.

Following are the types of conditional statement

  • if statement
  • ..else statement
  • ..elseif….else statement
  • switch statement

PHP if Statement

PHP if statement is used to execute the code block if the one condition is true.

Syntax:

Example:

Output

Nos is Equall to 5

PHP if… else Statement

PHP if- else statement is used to execute the condition whether it is true of false.

Syntax:

Example

Output

Sorry! You are not eligible for vote

PHP if..elseif ..else Statement

PHP if- elseif-else statement is used to execute one or more condition whether it is true of false.

Syntax:

Example:

Output

Today is Wednesday

Leave a Comment