Using namespaces: fallback to the global space for functions and constantsInside a namespace, when PHP encounters an unqualified Name in a class name, function or constant context, it resolves these with different priorities. Class names always resolve to the current namespace name. Thus to access internal or non-namespaced user classes, one must refer to them with their fully qualified Name as in: Example #1 Accessing global classes inside a namespace
For functions and constants, PHP will fall back to global functions or constants if a namespaced function or constant does not exist. Example #2 global functions/constants fallback inside a namespace
|