It's generaly considered that constructors are supposed return an instance of that class. Use a factory instead if you want to return nulls;
jsWalter wrote:
I found this in the docs...
If you want your constructor to possibly not create the object
class A { function A() { // ... // some error occurred $this = null; return; } }
I tested it, it works great.
Then I read on...
Setting $this to null isn't available in PHP 4.3.3R3 anymore. Maybe in version below also.
Great! :/
I have 4.3.2, so I guess it would work for me.
If this "feature" has been removed, can someone show me a good way to indicate a failure on object instantiation?
Thanks
Walter
-- http://www.radinks.com/upload Drag and Drop File Uploader.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php