Lokang 

PHP and MySQL

if

The if statement in PHP allows you to execute a block of code conditionally, based on the truth value of a given expression.

Here is an example of an if statement in PHP:

$x = 10;
if ($x > 5) {
   echo "x is greater than 5";
}

In this example, the code inside the curly braces will be executed if the value of $x is greater than 5.

You can also include an else clause to specify a block of code to be executed if the condition is not met:

$x = 10;
if ($x > 5) {
   echo "x is greater than 5";
} else {
   echo "x is not greater than 5";
}

You can also use the elseif clause to specify additional conditions to be tested:

$x = 10;
if ($x > 15) {
   echo "x is greater than 15";
} elseif ($x > 10) {
   echo "x is greater than 10 but not greater than 15";
} else {
   echo "x is not greater than 10";
}

In this example, the code inside the first if clause will not be executed because the condition is not met. The code inside the second elseif clause will also not be executed because the condition is not met. The code inside the final else clause will be executed because it is the last option and all previous conditions have not been met.