Hi Guys / Girls,
We are transitioning our framework to use the namespaces which are
available in php 5.3.
I found an explanation of the resolution rules here :
( also listed below)
and I was wondering what the performance implications of the different
stages of name resolution are. For example for the code in the
framework it's self would it be preferable to use a \Foo\Bar style
fully qualified class names in order for the resolution to be done at
Thanks in advance
1. Calls to fully-qualified functions, classes or constants are
resolved at compile-time.
2. Unqualified and qualified names are translated according to the
import rules, e.g. if the namespace A\B\C is imported as C, a call to
C\D\e() is translated to A\B\C\D\e().
3. Inside a namespace, all qualified names not already translated
according to import rules have the current namespace prepended, e.g.
if a call to C\D\e() is performed within namespace A\B, it is
translated to A\B\C\D\e().
4. Unqualified class names are translated according to current import
rules and the full name is substituted for short imported name, e.g.
if class C in namespace A\B is imported as X, new X() is translated to
5. Unqualified function calls within a namespace are resolved at
run-time. For example, if MyFunction() is called within namespace A\B,
PHP first looks for the function \A\B\MyFunction(). If that is not
found, it looks for \MyFunction() in the global space.
6. Calls to unqualified or qualified class names are resolved at
run-time. For example, if we call new C() within namespace A\B, PHP
will look for the class A\B\C. If that is not found, it will attempt
to autoload A\B\C.
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php