Re: Returning a reference [pretty much SOLVED]

From: Date: Thu, 09 Oct 2003 22:13:07 +0000
Subject: Re: Returning a reference [pretty much SOLVED]
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-165672@lists.php.net to get a copy of this message
On Thu, 9 Oct 2003 22:50:10 +0200, Esctoday.Com | Wouter Van Vliet <wouter@esctoday.com> wrote:
Thanks Curt. This solution works indeed. BUT, there's one but. Isn't there a way to not have to tell PHP that I want the return of $this->AddFoo() as a reference? In the actual code I want to worry as little as possible about specific things like this. Isn't it a little strange that you have to both let php know it's returning a reference as well as let it know that it's expecting a reference as return value?
well you do need to worry about it somewhere, and i would think that the function declaration: function &AddFoo() Would take care of this, but I think there is some strange things going on with the class. IIRC, issuing a $foo = $bar->AddFoo(); Doesn't return a reference. Hopefully someone here can mabey give some more insite as to why there has to be both the declaration and the call references. function &AddFoo() -and- $foo = &$bar->AddFoo(); Curt.

« previous php.general (#165672) next »