A

Admin • 832.27K Points
Coach

Q. What will be the output of the following PHP code ?

Code:
<?php
$opt = "1";
switch($opt)
{
case 1:
break;
print "First Statement";
case 2:
print "Second Statement";
break;
default:
print "Third Statement";
}
?>
  • (A) First Statement
  • (B) Second Statement
  • (C) Third Statement
  • (D) Nothing
  • Correct Answer - Option(D)
  • Views: 22
  • Filed under category PHP
  • Hashtags:

Explanation by: Admin

As break is provided before print statement in case 1 it breaks the loop before printing.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.