Lines Matching refs:namespace
13 namespace Zend\DB;
24 namespace name. Inside namespace, local name always takes precedence over
25 global name. Several files may be using the same namespace.
26 The namespace declaration statement must be the very first statement in
29 Every class and function in a namespace can be referred to by the full name
52 namespace or class. The simple form of statement "use A\B\C\D;" is
59 The special "empty" namespace (\ prefix) is useful as explicit global
60 namespace qualification. All class and function names started from \
64 namespace A\B\C;
69 A special constant __NAMESPACE__ contains the name of the current namespace.
73 namespace A\B\C;
81 In global namespace __NAMESPACE__ constant has the value of empty string.
83 Names inside namespace are resolved according to the following rules:
91 3) inside namespace, calls to unqualified functions that are defined in
92 current namespace (and are known at the time the call is parsed) are
93 interpreted as calls to these namespace functions.
94 4) inside namespace, calls to unqualified functions that are not defined
95 in current namespace are resolved at run-time. The call to function foo()
96 inside namespace (A\B) first tries to find and call function from current
97 namespace A\B\foo() and if it doesn't exist PHP tries to call internal
98 function foo(). Note that using foo() inside namespace you can call only
100 function from the global namespace.
102 first tries to use (and autoload) class from current namespace and in case
103 of failure uses internal PHP class. Note that using "new A" in namespace
104 you can only create class from this namespace or internal PHP class, however
105 using "new \A" you are able to create any class from the global namespace.
107 A\B\foo() first tries to call function foo() from namespace A\B, then
111 namespace. So "new A\B\C()" refers to class C from namespace A\B.
116 namespace A;
117 foo(); // first tries to call "foo" defined in namespace "A"
123 namespace A;
124 new B(); // first tries to create object of class "B" defined in namespace "A"
130 namespace A;
131 new A(); // first tries to create object of class "A" from namespace "A" (A\A)
136 namespace A;
137 B\foo(); // first tries to call function "foo" from namespace "A\B"
139 \B\foo(); // first tries to call function "foo" from namespace "B"
143 The worst case if class name conflicts with namespace name
145 namespace A;
146 A\foo(); // first tries to call function "foo" from namespace "A\A"
147 // then tries to call method "foo" of class "A" from namespace "A"
148 // then tries to call function "foo" from namespace "A"
150 \A\foo(); // first tries to call function "foo" from namespace "A"
157 * Support for namespace constants?
161 looks for such function in current namespace
163 for corresponding function in namespace