PHP: “if” statement

By Xah Lee. Date:

Example of “if” and “if else” statement:

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

Example of “elseif” statement:

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

If you have a question, put $5 at patreon and message me.