Javatpoint Logo
Javatpoint Logo

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

Flowchart

php if statement flowchart

Example

Output:

12 is less than 100

PHP If-else Statement

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

Syntax

Flowchart

php if-else statement flowchart

Example

Output:

12 is even number
Next TopicPHP Switch




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


B.Tech / MCA