Tutorials for PHP “if else” Condition

What is “The if...else Statement”?

You can improve the decision-making process by adding a separate argument to the if statement. When using the if-else statement, you must run one block of code if the condition is true, and another block of code if it is false. The following is an example of how it could be written:

C if else - w3resource

Syntax:-

if(condition){
    // Code to be executed if condition is true
} else{
    // Code to be executed if condition is false
}
PHP If Else - javatpoint

Example1:- When The Condition is True!

Output:-

Example2:- When The Condition is False!

Output:-

Tagged : / / / / / / / / /