Defining a function inside a conditional
Snippet 1 works. Snippet 2 doesn't. Why?

1.

    foo();
    
    function foo()
    {
    	// do soemething
    }

2.

    foo();
    
    if(!function_exists("foo"))
    {
    	function foo()
    	{
    		// do soemething
    	}
    }
Defining a function inside a conditional
===

Snippet 1 works. Snippet 2 doesn't. Why?

1.

    foo();
    
    function foo()
    {
    	// do soemething
    }

2.

    foo();
    
    if(!function_exists("foo"))
    {
    	function foo()
    	{
    		// do soemething
    	}
    }