<?php
class Foo
{ }
$className = "Foo";
$fooInstance = new $className;
?>
Works fine for me. It still works if you add methods or properties to
Foo as well, I'm not sure why it wouldn't work for you, possibly you
have another error along the lines somewhere. I am on PHP 5.0.1 BTW


On Tue, 2004-09-28 at 19:42, Curt Zirzow wrote:
> * Thus wrote Daniel Watrous:
> > Hello all,
> > 
> > I have a class Foo.  In PHP4 I could create an instance of Foo in the following 
> > manner:
> > $className = "Foo";
> > $fooInstance = new $className;
> > 
> > This would yield the same result as:
> > $fooInstance = new Foo;
> 
> Can you provide the definition of your class Foo. what you describe
> works find in php5.
> 
> Curt
> -- 
> The above comments may offend you. flame at will.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to