PHP If Else

PHP if else statement is used to test condition. There are various ways to use if statement in PHP.

  • if
  • if-else
  • if-else-if
  • nested if

PHP If Statement

PHP if statement is executed if condition is true.

Syntax

Example

Output:

PHP If-else Statement

PHP if-else statement is executed whether condition is true or false.

Syntax

Example

Output:

Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *