|
okay, say we're going with this code below
<?php
class Foo {
function __construct(&$Bar) {
$this->Bar = &$Bar;
}
}
class Bar {
function __construct() {
$this->Variable = "this";
$this->Foo = new Foo($this);
}
}
$Bar = new Bar();
echo "<pre>";
var_dump($Bar);
?>
When Bar is instantiated, it also instantiates Bar and passes everything in. Meaning when Foo is instantiated and Bar is passed in, $Bar->Foo->Bar->Variable is equal to "this".
Is there any way to stop a certain variable from being passed down like this?
Did it even make sense?
The reason I'm asking is because I'm concerned with performance. Theres an absolute ton of this going on in the framework I've been working on. Should I even be concerned with this?
|