ExamVeda
Login
Home
Control Structures(Loop in PHP)
?

What will be the output of the following PHP code ?
<?php
$x = 1;
if ($x == 2)
    print "hi" ;
else if($x = 2)
    print $x;
else
    print "how are u";
?>

Answer & Solution
Correct Answer: Option B
Enters if else as first condition is false and thus x is set to 2.
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.