Home » PHP » PHP Variables » Question
  1. What will be the output of the following PHP code ?
    <?php
    $p = -2;
    $q = 2;
    $r = $p * $q + $r;
    echo $r;
    ?>
    1. Undefined variable
    2. Undefined variable: r -4
    3. 2
    4. -2
    5. None of these
Correct Option: B

Since the variable r is not defined it returns the error also it takes r as 0 and returns the value -4.



Your comments will be displayed only after manual approval.