note 17111 added to language.oop

From: Date: Mon, 26 Nov 2001 23:18:51 +0000
Subject: note 17111 added to language.oop
Groups: php.notes 
Request: Send a blank email to php-notes+get-21298@lists.php.net to get a copy of this message
I have tried to get the referencing to work in a class, but.... here is an example: class test { function one($t) { $this->t = $t; } } class test2 { function &store(&$t) { $this->t = $t; } } $w = new test(); $w->one(3); print $w->t."\n"; $q = new test2(); $q->store(&$w); $w->one(5); print $w->t."\n"; print $q->t->t."\n"; --------- this prints 3 5 3, which is wrong. I have tried all variants of including & in the calls, but no one works. -- http://www.php.net/manual/en/language.oop.php http://master.php.net/manage/user-notes.php?action=edit+17111 http://master.php.net/manage/user-notes.php?action=delete+17111 http://master.php.net/manage/user-notes.php?action=reject+17111

« previous php.notes (#21298) next »