A

Admin • 833K Points
Coach

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

Code:
<?php
const $k = 10;
switch($k)
{
case 10:
print "First";
break;
case 11:
print "Second";
break;
default:
print "Third";
}
?>
  • (A) Third
  • (B) Second
  • (C) Error
  • (D) First
  • Correct Answer - Option(C)
  • Views: 63
  • Filed under category PHP
  • Hashtags:

Explanation by: Admin

Constants cannot be used in switch cases.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.