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. Greg -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php