Home / CSE / PHP - CS :: Discussion

Discussion :: PHP - CS

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

    <?php

    $x = 4;

    $y = -3;

    $z = 11;

    echo 4 + $y * $z / $x;

    ?>

  2. A.

     4.25

    B.

     3.25

    C.

     -3.25

    D.

     -4.25

    View Answer

    Workspace

    Answer : Option D

    Explanation :

    First the * is evaluated then / followed by + therefore we can rewrite this expression as 4 +((- 3 * 11) / 4) which results in -4.25.


Be The First To Comment