I'm not sure how to explain it, but having a class B referenced by class A, is it possible for class B to interact with class A?
class A {
function A($name) {
$this->name = $name;
}
function addB($name) {
$this->b = new B($name);
}
}
class B {
function B($name) {
$this->name = $name;
echo $a->name; // should echo $name set on class A
}
}
$a = new A("x");
$a->addB("y");