All pastes #784165 Raw Edit

trevarthan

public php v1 · immutable
·published 2007-11-19 16:06 UTC
rendered paste body
<?class A {  var $B;  var $data;  function A() {    $this->data = "A before";    $this->B = new B($this);  }  function set_data($value) {    $this->data = $value;  }  function do_print() {    print "{$this->data}\n";  }  function do_print_from_B() {    $this->B->A->do_print();  }}class B {  var $A;  var $data;  function B(&$a_ref) {    $this->data = "B before";    $this->A = &$a_ref;  }}$a = new A();$a->set_data("A after");$a->do_print();$a->do_print_from_B();?>result is:A afterA beforeresult *should* be:A afterA after