ExamVeda
Login
Home
Control Structures(Loop in PHP)
?

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

Answer & Solution
Correct Answer: Option C
The if statement has no brackets and it expects a else/else if after a if.
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.