P

Parvesh Kanani • 2.84K Points
Extraordinary

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

Code:
<?php
switch($k)
{
case 2:
    print "First";
    break;
case k:
    print "Second";
    break;
}
?>
  • (A) Undefined variable: k
  • (B) First
  • (C) Second
  • (D) Nothing
  • Correct Answer - Option(A)
  • Views: 104
  • Filed under category PHP

Explanation by: Parvesh Kanani
Case cannot be defined by a variable.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.


Question analytics