note 31134 added to language.references.whatdo

From: Date: Thu, 10 Apr 2003 20:46:22 +0000
Subject: note 31134 added to language.references.whatdo
Groups: php.notes 
Request: Send a blank email to php-notes+get-46464@lists.php.net to get a copy of this message
So to make a by-reference setter function, you need to specify reference semantics _both_ in the parameter list _and_ the assignment, like this: class foo{ var $bar; function setBar(&$newBar){ $this->bar =& newBar; } } Forget any of the two '&'s, and $foo->bar will end up being a copy after the call to setBar. -- http://www.php.net/manual/en/language.references.whatdo.php http://master.php.net/manage/user-notes.php?action=edit+31134 http://master.php.net/manage/user-notes.php?action=delete+31134 http://master.php.net/manage/user-notes.php?action=reject+31134

« previous php.notes (#46464) next »