You can return a value from a class constructor. It's just not that obvious.

class myclass {

        function myclass() {

                if($err){
                        $this = $err;
                        return;
                }
        }

}

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 14, 2001 2:23 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DEV] PHP 4.0 Bug #9253: Class constructors can't return
values


From:             [EMAIL PROTECTED]
Operating system: All
PHP version:      4.0.4pl1
PHP Bug Type:     Feature/Change Request
Bug description:  Class constructors can't return values

Class constructors can't abort instance creation, for example by returning
false...
This leads to a lot of "if (! $newobj->status)" crap.
Why is that ? I found a message on the PHP3 mailing list about this, but
it's still not there.


--
Edit Bug report at: http://bugs.php.net/?id=9253&edit=1




-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to