?
What will be the output of the following PHP code ?
What will be the output of the following PHP code ?
<?php
$b = 1;
switch(print $b)
{
case 2:
print "hello";
break;
case 1:
print "hi";
break;
default:
print "hi1";
}
?>
<?php
$b = 1;
switch(print $b)
{
case 2:
print "hello";
break;
case 1:
print "hi";
break;
default:
print "hi1";
}
?>
Answer & Solution
Correct Answer:
Option
B
Print returns 1,thus it gives case 1.
Join the Discussion
Login to post a comment or share your explanation.
Login