[UPHPU] Calling an object within an object
Jonathan Duncan
jonathan at jkdwebmagic.com
Sat Jun 10 11:18:13 MDT 2006
On Fri, 9 Jun 2006, Jon Jensen wrote:
> Whenever referencing a member variable from inside of a class function, you
> need to use the $this reference, otherwise it will look for the variable in
> the local scope (of the function).
>
> return $one->makeSelect($Array);
> //Throws an error, because there is no variable $one in the local scope
>
> return $this->one->makeSelect($Array);
> //Should work just fine, since the object has a member variable $one
>
That makes sense, but I was not aware that I could put more than one '->'
symbol on an object. Is this the best way to do it? or would it be
better to include the first class file in the second and then create the
first object inside of the second?
Jonathan
More information about the UPHPU
mailing list