ExamVeda
Login
Home
Control Structures(Loop in PHP)
?

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

Answer & Solution
Correct Answer: Option A
Upcasting does happen in case,it compares it with 1.0 and thus prints hi and exits.
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.