Req #62520 [Com]: Feature request: Anonymous Class

From: Date: Sat, 08 Aug 2015 22:12:28 +0000
Subject: Req #62520 [Com]: Feature request: Anonymous Class
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195036@lists.php.net to get a copy of this message
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)

« previous php.bugs (#195036) next »