?
What will be the output of the following PHP code ?
What will be the output of the following PHP code ?
<?php
$x = 1;
$y = 2;
if (++$x == $y++)
{
echo "true ", $y, $x;
}
?>
<?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.
Join the Discussion
Login to post a comment or share your explanation.
Login