The namespace keyword and __NAMESPACE__ magic constant
PHP supports two ways of abstractly accessing elements within the current namespace,
the
The value of Example #1 __NAMESPACE__ example, namespaced code
Example #2 __NAMESPACE__ example, global code
__NAMESPACE__ constant is useful for dynamically constructing
names, for instance:
Example #3 using __NAMESPACE__ for dynamic name construction
The Example #4 the namespace operator, inside a namespace
Example #5 the namespace operator, in global code
|