How does scope work for functions in PHP? Can I use function A (defined outside function B) from within function B?
Yes, you can do it like this:
function A()
{
...
}
function B()
{
A();
}
B();
From php manual:
All functions and classes in PHP have the global scope - they can be called outside a function even if they were defined inside and vice versa.
So yes, you can.
Variable scope if for variables.
There is no "scope" for functions... except when using namespaces.
Quoting the User-defined functions section of the manual :
All functions and classes in PHP have the global scope - they can be called outside a function even if they were defined inside and vice versa.