Mastering the if Statement in PHP: A Complete Guide
☰Fullscreen
Table of Content:
The if statement is used to execute a block of code only if the specified condition evaluates to true. This is the simplest PHP's conditional statements and can be written like:
Syntax:
if (condition) { code to be executed if condition is true; }
Example:
0) { printf("n is positive"); } ?>
Output:
If you will rum the above code, you will get the following output.
n is positive