Home » PHP » PHP Variables » Question
  1. What will be the output of the following PHP code ?
    <?php
    $r = 8;
    $s = -6;
    $t = 22;
    echo 8 + $s * $t / $r;
    ?>
    1. 8
    2. -6
    3. -8.5
    4. 11
    5. None of these
Correct Option: C

First the * is evaluated then / followed by + therefore we can rewrite this expression as 8 +((- 6 * 22) / 8) which results in -8.5.



Your comments will be displayed only after manual approval.