Noted.  You would have to change the signature of the function to function &

The statement still applies - even part of the point.

I'm really just wondering why things are the way they are.  Maybe I'm
thinking php is supposed to be more OO than it is.  Who wants to deal with
copies of objects so much that you have to specify if you want to work with
the actual object (by referencing)?  Why not $foo = clone($object) if you
want a copy? Why? Why? Why?  : p
Perhaps I'm just hoping to plant seeds for future versions (yeah right!).


----- Original Message -----
From: "Ernest E Vogelsinger" <[EMAIL PROTECTED]>
Sent: Monday, November 11, 2002 12:02 PM
Subject: Re: [PHP] method chaining

> At 17:57 11.11.2002, Terry McBride spoke out and said:
> --------------------[snip]--------------------
> >$tmp =& $foo->get("bar");  // note the &
> >$tmp->alterBarSomeWay();  // $tmp->getBaz();
> >
> >No way to do that in one line.  I think the reference conventions are
> >I can pass a variable to a function not knowing it may be referenced and
> >altered (unless I check the signature), but I have to know that what I'm
> >receiving from a function is a reference in order to grab it properly!?
> --------------------[snip]--------------------
> Note that both parties need to know the reference...
> assuming
>     function foo::get($id) {return $something;}
> it will not help (as to my knowledge) when you say
>     $tmp =& $foo->get('baz');
> The function must be coded as
>     function &foo::get($id) {return $something;}
> to return a reference. AND you have to accept the reference, or you'd get
> copy.
> --
>    >O Ernest E. Vogelsinger
>    (\) ICQ #13394035
>     ^

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to