"/>
Home / CSE / PHP - CS :: Discussion

Discussion :: PHP - CS

  1. What will be the output of the following PHP code ?

    <?php

    $x = 1;

    $y = 2;

    if (++$x == $y++)

    {

    echo "true ", $y, $x;

    }

    ?>

  2. A.

     no output

    B.

     true 23

    C.

     true 22

    D.

     true 33

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    x is preincremented and y is post incremented thus both are 2 in the if condition, later y is incremented.


Be The First To Comment