Re: classes in php5

From: Date: Wed, 29 Sep 2004 13:14:59 +0000
Subject: Re: classes in php5
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-198176@lists.php.net to get a copy of this message
Thank you all for your responses. It was indeed an error elsewhere in my code. Daniel Watrous ----- Original Message ----- From: "Matthew Fonda" <mfonda@dotgeek.org> To: "Curt Zirzow" <php-general@zirzow.dyndns.org> Cc: <php-general@lists.php.net> Sent: Tuesday, September 28, 2004 8:30 PM Subject: Re: [PHP] classes in php5 > <?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 > >

« previous php.general (#198176) next »