"> What will be the output of the following PHP code ?<?phpswitch($k){case

Home » PHP » PHP Switch Statement » Question
  1. What will be the output of the following PHP code ?
    <?php
    switch($k)
    {
    case 2:
    print "First";
    break;
    case k:
    print "Second";
    break;
    }
    ?>
    1. Undefined variable: k
    2. First
    3. Second
    4. Nothing
    5. None of these
Correct Option: A

Case cannot be defined by a variable.



Your comments will be displayed only after manual approval.