if
if
(PHP 4, PHP 5, PHP 7)
The if construct is one of the most important features of many languages, PHP included. It allows for conditional execution of code fragments. PHP features an if structure that is similar to that of C:
if (expr) statement
As described in the section about expressions, expression is evaluated to its Boolean value. If expression evaluates to TRUE
, PHP will execute statement, and if it evaluates to FALSE
- it'll ignore it. More information about what values evaluate to FALSE
can be found i