Home » PHP » PHP Switch Statement » Question
  1. What will be the output of the following PHP code ?
    <?php
    $p = "1";
    $p = 1;
    $q = 1;
    switch($p)
    {
    case $p * $q:
    print "Hello";
    break;
    case $p / $q:
    print "Hey";
    break;
    default:
    print "Bye";
    }
    ?>
    1. Hello
    2. Hey
    3. Bye
    4. Error
    5. None of these
Correct Option: A

It checks the first case, when it finds it equal it will perform it breaks out.



Your comments will be displayed only after manual approval.