Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:41411 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29350 invoked from network); 27 Oct 2008 02:51:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Oct 2008 02:51:02 -0000 Authentication-Results: pb1.pair.com header.from=robert@interjinn.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=robert@interjinn.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain interjinn.com from 66.11.173.122 cause and error) X-PHP-List-Original-Sender: robert@interjinn.com X-Host-Fingerprint: 66.11.173.122 unknown Received: from [66.11.173.122] ([66.11.173.122:9382] helo=interjinn.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 27/35-34199-59C25094 for ; Sun, 26 Oct 2008 21:51:01 -0500 Received: from [192.168.1.3] (blobule.suds [192.168.1.3]) by interjinn.com (Postfix) with ESMTP id 8AADA11FB7A; Sun, 26 Oct 2008 22:50:46 -0400 (EDT) To: Greg Beaver Cc: Andrew Mason , nrixham@gmail.com, internals@lists.php.net, Lukas Kahwe Smith In-Reply-To: <49052B6D.2090502@chiaraquartet.net> References: <49048EC1.9060908@chiaraquartet.net> <4904F238.8040909@gmail.com> <99cd336d0810261558w4d6388edl63eb94b3422d56b5@mail.gmail.com> <1225075131.4941.28.camel@localhost> <49052B6D.2090502@chiaraquartet.net> Content-Type: text/plain Organization: InterJinn Date: Sun, 26 Oct 2008 22:51:10 -0400 Message-ID: <1225075870.4941.30.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: namespace separator and whining From: robert@interjinn.com (Robert Cummings) On Sun, 2008-10-26 at 21:46 -0500, Greg Beaver wrote: > Robert Cummings wrote: > > On Mon, 2008-10-27 at 09:28 +1030, Andrew Mason wrote: > >> So can I just confirm that what was previously > >> > >> >> > >> $x = new Framework::Utils::Foo(); > >> $y = new Project::PEAR::Bar( 'somestring' ); > >> > >> > >> ?> > >> > >> is now > >> > >> >> > >> $x = new Framework\Utils\Foo(); > >> $y = new Project\PEAR\Bar( 'somestring' ); > >> > >> ?> > >> > >> > >> Is this correct ? > > > > Wouldn't it be: > > > > > > > $x = new Framework\Utils::Foo(); > > $y = new Project\PEAR::Bar( 'somestring' ); > > ?> > > The correct syntax is: > > // initialize class > $a = new Framework\Utils\Foo(); > // namespaced function > Framework\Utils\parse($string); > // static method > Project\PEAR\XML::makeEntity('\\'); > // namespaced constant > if ($a == Framework\Utils\FOO) echo "hi"; > // class constant > if ($a == Project\PEAR\XML::ZOMG) echo "bye"; > ?> > > Note that static class elements are accessed using T_DOUBLE_COLON (::), > and that the namespace separator \ is used to join namespace and element > name. Sorry, my mistake, I didn't notice the 'new' contsruct. Sorry for the pollution. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP