Account
Categories

If Statement


It is a conditional statement that checks the condition. If the condition is found to be true, the code inside the if braces will execute.

And if the condition is false, it skips the code inside the if braces and goes to the next one.

Syntax:
if (condition) {
    //  if the condition is true then code runs.
}
Example:
<?php
$temperature = 30;

if ($temperature > 25) {
    echo "It is a hot day.";
}
?>
Output:
It is a hot day.