On Fri, 2008-06-06 at 11:35 -0400, Christoph Boget wrote:
> > The 'new' keyword has to apply to the object created in the constructor (and
> > not the return value of any of the follow-up calls.) To establish this
> > precedence, chaining wasn't allowed on constructors.
>
> If precedence was th
> The 'new' keyword has to apply to the object created in the constructor (and
> not the return value of any of the follow-up calls.) To establish this
> precedence, chaining wasn't allowed on constructors.
If precedence was the issue, why doesn't this work, either:
(new bob())->one()->two()
The 'new' keyword has to apply to the object created in the constructor (and
not the return value of any of the follow-up calls.) To establish this
precedence, chaining wasn't allowed on constructors.
On Fri, Jun 6, 2008 at 11:04 AM, Eric Butera <[EMAIL PROTECTED]> wrote:
> On Fri, Jun 6, 2008
On Fri, Jun 6, 2008 at 11:00 AM, Christoph Boget <[EMAIL PROTECTED]> wrote:
>> > Why? I thought constructors returned the object?
>> It's been a while since I've played with objects in PHP, but couldn't
>> you just add the line:
>> return $this;
>> ...to the end of your __construct() function? Sor
> > Why? I thought constructors returned the object?
> It's been a while since I've played with objects in PHP, but couldn't
> you just add the line:
> return $this;
> ...to the end of your __construct() function? Sorry if this is obtuse of
> me to say, I just thought maybe the answer was that sim
> -Original Message-
> From: Christoph Boget [mailto:[EMAIL PROTECTED]
> Sent: Friday, June 06, 2008 9:45 AM
> To: PHP General
> Subject: [PHP] Method chaining off constructors
>
> Is there a reason why you can't do method chaining off of
constructors?
>
> Consider the following class:
>
6 matches
Mail list logo