Re: Re: namespace separator and whining
| From: | Steph Fox | Date: | Mon, 27 Oct 2008 02:58:08 +0000 |
| Subject: | Re: Re: namespace separator and whining | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-41412@lists.php.net to get a copy of this message | ||
Hi lover,
(sorry, couldn't resist)
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.OK... thanks for the clarification. That does actually make perfect sense to me, I just read :: as a method call in Robert's example rather than as a new class. Guess I should sleep before typing 'as I understand it' again :) - Steph