ExamVeda
Login
Home
Control Structures(Loop in PHP)
?

What will be the output of the following PHP code ?
<?php
$a = "2";
switch ($a)
{
case 1:
    print "hi";
case 2:
    print "hello";
    break;
default:
    print "hi1";
}
?>

Answer & Solution
Correct Answer: Option B
As hello is provided after case2 it breaks the loop.
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.