Log in / create account | Login with OpenID
DocForge
Programmer's Wiki

PHP/if

From DocForge

< PHP

if is a control flow statement which allows a PHP script to go down one of two execution paths based on an expression. If the expression evaluates to true, the first path is followed. If the expression evaluations to false, the first path is ignored and the else path is followed if it exists.

[edit] Syntax

if (<expression>) {
    <statements>
}
else {
    <statements>
}