RE: [PHP-DEV] PHP 4.0 Bug #9253: Class constructors can't return values
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=9253edit=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]
Re: [PHP-DEV] PHP 4.0 Bug #9253: Class constructors can't return values
If Nathan's suggestion is not just an unreliable side effect, maybe this should be documented. (ie changed from Feature/Change request) regards, Alan. - Original Message - From: "Nathan Cassano" [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, February 15, 2001 11:11 AM Subject: RE: [PHP-DEV] PHP 4.0 Bug #9253: Class constructors can't return values 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=9253edit=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] -- 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]
[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=9253edit=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]