php if else endif code example
Example 1: php if elseif
$a = random_int(0, 10);
$b = random_int(0, 10);
if ($a > $b) {
echo 'a is greater than b';
} elseif ($a == $b) {
echo 'a is equal to b';
} else {
echo 'a is less than b';
}
Example 2: PHP if...else...elseif Statements
<?php
$t = date("H");
if ($t < "20") {
echo "Have a good day!";
}
?>