What is If statement?
If the conditions stated are true, the (if
statement) is used to execute the code block. In PHP, these are the most basic and cross-platform statements. The if statement in PHP allows code to be executed only if it meets certain criteria. It is executed if condition is True.
Syntax:-
if (condition) {
code to be executed if condition is true;
}
Examples:-
Output:-