?
What will be the output of the following PHP code ?
What will be the output of the following PHP code ?
<?php
$a = "1";
switch ($a)
{
case 1:
print "hi";
case 2:
print "hello";
default:
print "hi1";
}
?>
<?php
$a = "1";
switch ($a)
{
case 1:
print "hi";
case 2:
print "hello";
default:
print "hi1";
}
?>
Answer & Solution
Correct Answer:
Option
A
As break is not provided it executes all the cases.
Join the Discussion
Login to post a comment or share your explanation.
Login