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)

    {

    echo $y;

    }

    ?>

  2. A.

     2

    B.

     1

    C.

     3

    D.

     no output

    View Answer

    Workspace

    Answer : Option A

    Explanation :

    First $y = 2 is compared to and then decremented, then incremented and compared to $y = 2.


Be The First To Comment