php if else elseif code example
Example 1: php elseif
<?php
if ($a > $b) {
echo "a is bigger than b";
} elseif ($a == $b) {
echo "a is equal to b";
} else {
echo "a is smaller than b";
}
?>
Example 2: php if else
<?php
if ($a > $b) {
echo "a is bigger than b";
} elseif ($a == $b) {
echo "a is equal to b";
} else {
echo "a is smaller than b";
}
?>
Example 3: PHP if...else...elseif Statements
<?php
$t = date("H");
if ($t < "20") {
echo "Have a good day!";
}
?>