<?php
$alice = 25;
$bobby = 20;
if ($alice < $bobby) {
echo "Alice has less than Bobby.";
} elseif ($alice > $bobby) {
echo "Alice has more than Bobby.";
} else {
echo "Alice has the same as Bobby.";
}
?>
Comparison operators
Logical operators
switch()
<?php
switch($i) {
case 0:
echo "i equals 0";
break;
case 1:
echo "i equals 1";
break;
case 2:
echo "i equals 2";
break;
default:
echo "i is not equal to 0, 1 or 2";
break;
}
?>