Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:33918 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30432 invoked by uid 1010); 11 Dec 2007 07:32:01 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 30416 invoked from network); 11 Dec 2007 07:32:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Dec 2007 07:32:01 -0000 Authentication-Results: pb1.pair.com smtp.mail=mp@webfactory.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=mp@webfactory.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain webfactory.de from 195.227.108.51 cause and error) X-PHP-List-Original-Sender: mp@webfactory.de X-Host-Fingerprint: 195.227.108.51 wfserver02.wf-ppr.de Windows 2000 SP2+, XP SP1 (seldom 98 4.10.2222) Received: from [195.227.108.51] ([195.227.108.51:9063] helo=wfserver02.wf-ppr.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E7/C8-58921-FEC3E574 for ; Tue, 11 Dec 2007 02:32:00 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Tue, 11 Dec 2007 08:31:56 +0100 Message-ID: <00A2E2156BEE8446A81C8881AE117F199A0715@companyweb> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PHP-DEV] Namespace resolution Thread-Index: Acg7dn1a51uBEDczQQevwM6sa+LejQAUUsdg References: <11970653983080000@9866357972520000.9866341568840000> <475BDDF1.7040605@ctindustries.net> <1723341090.20071210220025@marcus-boerger.de> <1197323296.3922.5.camel@sbarrow-desktop> To: "Sam Barrow" , Subject: AW: [PHP-DEV] Namespace resolution From: mp@webfactory.de ("Matthias Pigulla") > -----Urspr=FCngliche Nachricht----- > Von: Sam Barrow [mailto:sam@sambarrow.com] > Gesendet: Montag, 10. Dezember 2007 22:48 > An: internals@lists.php.net > Betreff: [PHP-DEV] Namespace resolution >=20 > Ok, it's supposed to be this way right? If i define a custom class in > the global namespace called "myClass" and I'm in another namespace, I > can only access it using ::myClass, not just myClass (without the > colons)? Seems to me that it should check the local namespace and then > the global, but it only checks the globl if i specifically tell it to > with the preceding "::". From http://www.php.net/manual/en/language.namespaces.rules.php: -- Inside namespace (say A::B), calls to unqualified class names are = resolved at run-time. Here is how a call to new C() is resolved: 1. It looks for a class from the current namespace : A::B::C(). 2. It tries to find and call the internal class C(). 3. It attemts to autoload A::B::C(). C(). To reference a user defined class in the global namespace, new ::C() has = to be used. -- Which is exactly what you observed. -mp.