Re: Re: function call chaining

From: Date: Wed, 20 Jan 2010 15:45:30 +0000
Subject: Re: Re: function call chaining
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-46839@lists.php.net to get a copy of this message
On Tue, January 19, 2010 10:20 am, Eddie Drapkin wrote: > On Tue, Jan 19, 2010 at 11:05 AM, Stanislav Malyshev <stas@zend.com> > wrote: >> The second was next on my list, while the first seems to me kind of >> exotic - >> why create object only to call one method and immediately drop it? >> Why this >> method is not static then? > > > Why would this imply "dropping" the object? > > This: > $foo = (new bar())->someSetter(); > Looks a lot better than this > $foo = new bar(); > $foo->someSetter(); I would expect the first to put the result of someSetter() into $foo, not the actual bar object... For that, I'd expect to see: ($foo = new bar())->someSetter(); -- Some people ask for gifts here. I just want you to buy an Indie CD for yourself: http://cdbaby.com/search/from/lynch

« previous php.internals (#46839) next »