Re: AW: [PHP-DEV] Namespace resolution
| From: | David Zülke | Date: | Wed, 12 Dec 2007 00:17:32 +0000 |
| Subject: | Re: AW: [PHP-DEV] Namespace resolution | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-33953@lists.php.net to get a copy of this message | ||
Am 12.12.2007 um 01:04 schrieb Stanislav Malyshev:
Ah, yes, of course, my bad. Well, the problem still exists inside a namespace, right? And didn't you say "use" is a NOP just two hours ago? DavidWhy? I did import Name::Space. According to the current lookup rules, the first new DateTime() call creates a PHP internal class since Name::Space::DateTime cannot be found (and autoloading would only be triggered later), and the second DateTime() call does create Name::Space::DateTime because by then, it has been autoloaded and thus can be found in the current namespace.Current namespace in your example is global space. Please reread the docs on what "use" operator does and what "namespace" operator does. I would also recommend avoiding "import" in your examples sine such operator no longer exists.