An else if ladder is a special case of nested if statement where nesting take place
only in the else part when an action has to be selected based on range of value then this statement is used.
Q.) W.A.P to print the output of the program using else if ladder statement.
<html>
<body>
<?php
$marks=75;
if($marks>=90)
echo“ O”;
else if($marks>=80&&$marks<89)
echo(“A”);
else if($marks>=70&&$marks<80)
echo “B”;
else if($marks>=60&&$marks<70)
echo “C”;
else if($marks>=50&&$marks<60)
echo “D”;
else if($marks>=40&&$marks<50)
echo “E”;
else
echo “F”;
}
?>
</body>
</html>
Output
B