0
<?php
function foo()
{
    function bar()
    {
        echo "this is bar";
    }
}

bar();
// Error occurs becauase function 'bar' has not been defined

foo();
//execute 'foo' function.

bar();
//execute 'bar' function defined in foo function.
//How is it possible?
?>

In the above code, I thought function 'bar' will be get rid from memory after finishing 'foo' routine, but i found it is working. How is it possible?

0 Answers0