Bug #4054: Strange behavior of class variables

From: Date: Thu, 06 Apr 2000 00:32:15 +0000
Subject: Bug #4054: Strange behavior of class variables
Groups: php.dev 
Request: Send a blank email to php-dev+get-17657@lists.php.net to get a copy of this message
From: DerMurx@gmx.de Operating system: Windows 95/98/NT PHP version: 3.0.16 PHP Bug Type: Other Bug description: Strange behavior of class variables Have a look at this piece of code: class User { var $Name; var $Mail function SetUser() { $this->$Name = "Bill"; $this->$Mail = "bill@whitehouse.gov"; echo $this->$Name, ":", $this->$Mail; } } Maybe you will notice the mistake with the $ sign ($this->$Name instead of $this->Name, see bug report #60). But PHP doesn't print an error, it interprets the code and outputs this: bill@whitehouse.gov:bill@whitehouse.gov So, either PHP should produce an error, or there should be a better description of the missing $ sign in the "Classes and Objects" section of the documentation.

« previous php.dev (#17657) next »