Re: Dynamic class names and namespaces

From: Date: Mon, 22 Oct 2007 19:34:29 +0000
Subject: Re: Dynamic class names and namespaces
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-32914@lists.php.net to get a copy of this message
On Sunday 21 October 2007, Stanislav Malyshev wrote: > > Using dynamic class names works fine without namespaces, but > > doesn't work at all with namespaces. Take this simple example: > > > > <?php > > namespace test; > > class Foo {} > > $class = "Foo"; > > $foo = new test::$class(); > > ?> > > > > Will produce the following message: > > Fatal error: Class 'test::test' not found in foo.php on line Y > > I don't think partially variable class name is supposed to work. It is > interesting though how the engine managed to parse this at all... Ahh, I see, that's a bit disappointing. Any reason why it doesn't/shouldn't work ? /Magnus -- One of the most striking differences between a cat and a lie is that a cat has only nine lives. -- Mark Twain, "Pudd'nhead Wilson's Calendar"

« previous php.internals (#32914) next »