classes in php5
| From: | Daniel Watrous | Date: | Tue, 28 Sep 2004 19:46:27 +0000 |
| Subject: | classes in php5 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-198113@lists.php.net to get a copy of this message | ||
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;
In my efforts to port this over to PHP5 I am having trouble. Not only do I not get back an instance
of my Foo class, but the script execution stops entirely without so much as a warning. Is this a
bug? Is there a new mechanism in PHP5, such as a getInstance function (i.e. object getInstance
(string className))? Thanks in advance for any comments!
Daniel