Home / CSE / PHP - CS :: Discussion

Discussion :: PHP - CS

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

    <?php

    $y = 2;

    if (--$y <> ($y != $y++))

    {

    echo $y;

    }

    ?>

  2. A.

     1

    B.

     0

    C.

     2

    D.

     no output

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    –$y == 2 is false but y is decremented, the xor gives true if only one of the operands are true, thus 1 xor 0 is true.


Be The First To Comment