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
> >>
> >> <?php
> >>
> >>               $x = new Framework::Utils::Foo();
> >>               $y = new Project::PEAR::Bar( 'somestring' );
> >>
> >>
> >> ?>
> >>
> >> is now
> >>
> >> <?php
> >>
> >>               $x = new Framework\Utils\Foo();
> >>               $y = new Project\PEAR\Bar( 'somestring' );
> >>
> >> ?>
> >>
> >>
> >> Is this correct ?
> > 
> > Wouldn't it be:
> > 
> > <?php
> > 
> >     $x = new Framework\Utils::Foo();
> >     $y = new Project\PEAR::Bar( 'somestring' );
> > ?>
> 
> The correct syntax is:
> 
> <?php
> // 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


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to