Home » PHP » PHP Introduction » Question
  1. What will be the output of the following PHP code?
    <?php
    $State = "Chennai";
    switch ($State) {
    case "Mumbai":
    echo "I love Mumbai. ";
    case "Chennai":
    echo "I love Chennai. ";
    case "Rajshathan":
    echo "I love Rajshatan. "; }
    ?>
    1. I love Chennai. I love Mumbai.
    2. I love Mumbai.
    3. Error
    4. I love Chennai. I love Rajshatan.
    5. None of these
Correct Option: D

If a break statement isn’t present, all subsequent case blocks will execute until a break statement is located.



Your comments will be displayed only after manual approval.