Home » PHP » PHP Variables » Question
  1. What will be the output of the following PHP code ?
    <?php
    $p = 6;
    $q = 5;
    function Res($p = 5, $q = 6)
    {
    $r = $p+$q/$q+$p;
    echo "$r";
    }
    echo $p;
    echo $q;
    echo $r;
    Res($p, $q);
    ?>
    1. Nothing
    2. 6
    3. 5
    4. 65
    5. 6513
Correct Option: E

Firstly, the statements outside the function are printed, since r is not defined it’ll no value is printed for r. Next the function is called and the value of r inside the function is printed.



Your comments will be displayed only after manual approval.