PHP: Conditional

By Xah Lee. Date:

If-Statement

<?php
if (5 > 4) {echo "yay!";}

If-Else Statement

<?php
if (3 > 4) {echo "yay!";} else {echo "Nooo!";}

Elseif Statement

<?php
$a=3; $b=4;
if ($a > $b) {
    echo "O No!";
} elseif ($a == $b) {
    echo "O Yes";
} else {
    echo "Problem!";
}