#36221 [Opn->Csd]: new __CLASS__() would be nice
| From: | helly@php.net | Date: | Wed, 01 Feb 2006 00:21:32 +0000 |
| Subject: | #36221 [Opn->Csd]: new __CLASS__() would be nice | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-92735@lists.php.net to get a copy of this message | ||
ID: 36221
Updated by: helly@php.net
Reported By: david at tulloh dot id dot au
-Status: Open
+Status: Closed
Bug Type: Feature/Change Request
-Operating System: Debian Linux
+Operating System: *
-PHP Version: 5.1.2
+PHP Version: 5.*
-Assigned To:
+Assigned To: helly
New Comment:
Use 'self' instead:
php -r 'class t{static function f(){ var_dump(new self);}} t::f();'
Previous Comments:
------------------------------------------------------------------------
[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