ExamVeda
Login
Home
Operators and Expressions in php
?

What will be the output of the following PHP code ?
<?php
$x = 1;
$y = 2;
if (++$x == $y++)
{
    echo "true ", $y, $x;
}
?>

Answer & Solution
Correct Answer: Option B
x is preincremented and y is post incremented thus both are 2 in the if condition, later y is incremented.
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.