Home » PHP » PHP Functions » Question
  1. What will be the output of the following PHP code?
    <?php
    $option2 = "Mania";
    function fun($option1)
    {
    echo $option1;
    echo $option2;
    }
    fun("Interview");
    ?>
    1. Error
    2. Mania
    3. Interview
    4. Interview Mania
    5. None of these
Correct Option: C

If u want to put some variables in function that was not passed by it, you must use “global”. Inside the function type global $option2.



Your comments will be displayed only after manual approval.