Req #62520 [Com]: Feature request: Anonymous Class
Edit report at https://bugs.php.net/bug.php?id=62520&edit=1
ID: 62520
Comment by: php at mcq8 dot be
Reported by: k at webnfo dot com
Summary: Feature request: Anonymous Class
Status: Open
Type: Feature/Change Request
Package: *General Issues
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
This actually works in php7 (https://wiki.php.net/rfc/anonymous_classes)
Previous Comments:
------------------------------------------------------------------------
[2012-07-10 05:10:15] k at webnfo dot com
Description:
------------
The syntax imagined as below (Define And Initiate An Anonymous Class):
$object = (new class($param1, $param1){
public $var1 = 'abc'
public function test(){
echo $this->var1;
}
});
$object->test();
out: 'abc'
============ Or Alternatively ===================
(new class($param1, $param1){
public $var1 = 'abc'
public function test(){
echo $this->var1;
}
})->test();
out: 'abc'
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62520&edit=1
Thread (3 messages)