Nested PHP if and if else statements can be confusing however if following the correct formatting and PHP basics they can be a very useful piece of code.
In the example below i define $var as 88 and do some comparisons to find where it sits in between higher and lower numbers.
$var = 88;
if ($var >= 100) {
if ($var <= 200) {
echo "Var is in between 100 and 200";
} else if ($var <= 500) {
echo "Var is in between 200 and 500";
} else if ($var <= 900) {
echo "Var is in between 500 and 900";
}
} else if ($var <= 100) {
if ($var >= 50) {
if ($var <= 90) {
if ($var >= 80) {
echo "Var in between 80 and 90";//this will be what gets echoed
}
else if ($var >= 89) {
echo "Var in between 89 and 90";
}
}
}
}