RE: [PHP-DEV] [RFC] new foo()->bar()

From: Date: Fri, 26 Nov 2010 21:53:10 +0000
Subject: RE: [PHP-DEV] [RFC] new foo()->bar()
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-50607@lists.php.net to get a copy of this message
November-26-10 2:36 PM, Felipe Pena writes: > Hi all, > I'm here again to presents another proposal, which adds support for > instantiating a class and calling its methods and accessing its > properties on same command. > > Example: > > <?php > > class bar { > public $x = 'PHP'; > } > > class foo extends bar { > public function bar() { > return $this; > } > } > > var_dump(new foo()->bar()->x); // string(3) "PHP" > > ?> > > Other examples which describes the feature at > http://wiki.php.net/rfc/instance-method-call > > Thoughts? Nice. I have use for this. Some readability issues may arise but nothing that can't be overcome with some common sense. Best Regards, Mike Robinson

« previous php.internals (#50607) next »