All pastes #752636 Raw Edit

Someone

public php v1 · immutable
#752636 ·published 2007-10-28 16:26 UTC
rendered paste body
<?php$test2 = new cl2();class cl1 {  var $test = 'a';  function cl1() {    global $test2;    $test2->change($this);  }}class cl2 {  var $ref;  function change(&$obj) {    $this->ref = &$obj;    $this->ref->test = 'b';  }  function change_new() {    $this->ref->test = 'c';  }}$testobj = new cl1();echo $testobj->test; // echoes 'b'// note: it works when if call $test2->change($testobj); here$test2->change_new(); // echoes 'b' (not c)!!?echo $testobj->test;?>