Q. What will be the output of the following PHP code ?
Code:
<?php
$s = 2.2;
switch($s)
{
case 2.1:
print "Option A";
break;
case 2.2:
print "Option B";
break;
default:
print "Option C";
}
?>
β
Correct Answer: (C)
Option B
Explanation: it compares it with 2.2 and thus prints Option B and exits.