RE: [PHP-DEV] PHP 4.0 Bug #9253: Class constructors can't return values
| From: | Nathan Cassano | Date: | Thu, 15 Feb 2001 19:11:27 +0000 |
| Subject: | RE: [PHP-DEV] PHP 4.0 Bug #9253: Class constructors can't return values | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-46691@lists.php.net to get a copy of this message | ||
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: stefan.p@noos.fr [mailto:stefan.p@noos.fr]
Sent: Wednesday, February 14, 2001 2:23 AM
To: php-dev@lists.php.net
Subject: [PHP-DEV] PHP 4.0 Bug #9253: Class constructors can't return
values
From: stefan.p@noos.fr
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