Home » PHP » PHP Switch Statement » Question
  1. What will be the output of the following PHP code ?
    <?php
    const $k = 10;
    switch($k)
    {
    case 10:
    print "First";
    break;
    case 11:
    print "Second";
    break;
    default:
    print "Third";
    }
    ?>
    1. Third
    2. Second
    3. Error
    4. First
    5. None of these
Correct Option: C

Constants cannot be used in switch cases.



Your comments will be displayed only after manual approval.