?
What will be the output of the following PHP code ?
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";
?>
<?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.
Join the Discussion
Login to post a comment or share your explanation.
Login