#36221 [Csd]: new __CLASS__() would be nice
| From: | david at tulloh dot id dot au | Date: | Wed, 01 Feb 2006 02:35:28 +0000 |
| Subject: | #36221 [Csd]: new __CLASS__() would be nice | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-92736@lists.php.net to get a copy of this message | ||
ID: 36221
User updated by: david at tulloh dot id dot au
Reported By: david at tulloh dot id dot au
Status: Closed
Bug Type: Feature/Change Request
Operating System: *
PHP Version: 5.*
Assigned To: helly
New Comment:
excellent, thankyou
Previous Comments:
------------------------------------------------------------------------
[2006-02-01 01:21:31] helly@php.net
Use 'self' instead:
php -r 'class t{static function f(){ var_dump(new self);}} t::f();'
------------------------------------------------------------------------
[2006-01-31 08:18:17] david at tulloh dot id dot au
Description:
------------
It would be nice if, $object = new __CLASS__(); was supported.
Currently this throws a parse/syntax error,
Parse error: syntax error, unexpected T_CLASS_C, expecting T_STRING or
T_VARIABLE or '$' in ...
This does work as expected,
$foo = __CLASS__;
$object = new $foo();
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36221&edit=1