Home » PHP » PHP Variables » Question
  1. What will be the output of the following PHP code ?
    <?php
    $m = 15;
    $n = 8;
    $p = fun(15,8);
    function fun($m,$n)
    {
    $n = 7;
    return $m - $n + $n - $m;
    }
    echo $m;
    echo $n;
    echo $p;
    ?>
    1. Error
    2. 18
    3. 8
    4. 1580
    5. None of these
Correct Option: D

The value returned from the function is 0, and value of m is 15, value of n is 8 and p is 0.



Your comments will be displayed only after manual approval.