Home » PHP » PHP Switch Statement » Question
  1. What will be the output of the following PHP code ?
    <?php
    $opt = "1";
    switch ($opt)
    {
    case 1:
    print "Hello ";
    case 2:
    print "Interview ";
    default:
    print "Mania ";
    }
    ?>
    1. Hello Interview Mania
    2. Interview
    3. Mania
    4. Hello
    5. None of these
Correct Option: A

As break is not provided it executes all the cases.



Your comments will be displayed only after manual approval.