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:
print "Hello ";
case 2:
print "MCQ";
default:
print "Buddy";
}
?>
  • (A) Hello MCQ Buddy
  • (B) MCQ
  • (C) Buddy
  • (D) Hello
  • Correct Answer - Option(A)
  • Views: 18
  • Filed under category PHP
  • Hashtags:

Explanation by: Admin

As break is not provided it executes all the cases.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.