note 6945 modified in Classes and Objects by ronabop
| From: | ronabop@php.net | Date: | Thu, 17 Aug 2000 10:02:46 +0000 |
| Subject: | note 6945 modified in Classes and Objects by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-2171@lists.php.net to get a copy of this message | ||
"Why passing arguments by reference doesn't work within a class":
The problem lies not with the referenced argument but with the testVar member of the Test class.
This variable is NOT a reference so when you assign the parameter to it, it copies the string to it.
from a test i did .. you should simply change the setTestVar() function to this:
<PRE>$this-testVar = &$ref;</PRE>
NOTE: i'm pretty new to the PHP world and can't certify that what i say is right but it is
my assumption based on my experience with other programming languages.
http://www.php.net/manual/classes-and-objects.php