-
What will be the output of the following PHP code ?
<?php
function fun($opt)
{
switch($opt)
{
case 10:
echo 'Case 10 will execute.';
break;
case 20:
echo 'Case 20 will execute.';
break;
case 30:
echo 'Case 30 will execute.';
break;
case 40:
echo 'Case 40 will execute.';
break;
default:
echo 'Default will execute.';
break;
}
}
fun(20);
?>
-
- Case 10 will execute.
- Case 20 will execute.
- Case 30 will execute.
- Case 40 will execute.
- Default will execute.
Correct Option: B
The switch statement is executed with $opt = 20.