If Statements


It is used When Condition is True.

Syntax

if (condition) {
    code to be executed if condition is true
;
}

The example below will output "Value of X is Small" if the value of x is less than 10:

Example

<?php
$x = 5;

if ($x < "10") {
    echo "Value of X is Small";
}
?>

Run Example>>