Home » PHP » PHP Functions » Question
  1. What will be the output of the following PHP code?
    <?php
    function fun1()
    {
    function fun2()
    {
    echo 'I am Ajit.';
    }
    echo 'I am Rahul';
    }
    fun2();
    fun1();
    ?>
    1. Error
    2. I am Ajit.
    3. I am Rahul.
    4. I am Rahul. I am Ajit.
    5. None of these
Correct Option: A

This will be the output- Fatal error: Call to undefined function fun2(). You cannot call a function which is inside a function without calling the outside function.



Your comments will be displayed only after manual approval.