[thelist] basic OO php question

kasimir-k kasimir.k.lists at gmail.com
Wed Apr 18 05:28:28 CDT 2007


Rick den Haan scribeva in 18/04/2007 8:31:
> I could potentially pass $this along, but I
> doubt if that's a very recommendable practice.

It would be exactly what I'd recommend.

In X you'd have:
$y = new Y($this);

and in Y:
function Y(&$ref) {
    echo $ref->foo;
}

Note that you are passing a reference, not a copy.

.k



More information about the thelist mailing list