PHP Two if Conditions
Example of using two if conditions:
<?php
$a = 3;
if ($a == 0) {
echo 'Equals zero!';
} elseif ($a > 0) {
echo 'Greater than zero!';
} else {
echo 'Less than zero!';
}
?>
You can also nest if
statements inside each other:
<?php
$a = 3;
if (isset($a)) {
if ($a >= 0) {
echo 'Positive!';
} else {
echo 'Negative!';
}
} else {
echo 'Does not exist!';
}
?>