#4054 [Opn->Bgs]: Strange behavior of class variables
| From: | hholzgra@php.net | Date: | Mon, 30 Sep 2002 23:14:39 +0000 |
| Subject: | #4054 [Opn->Bgs]: Strange behavior of class variables | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-20816@lists.php.net to get a copy of this message | ||
ID: 4054
Updated by: hholzgra@php.net
Reported By: DerMurx@gmx.de
-Status: Open
+Status: Bogus
Bug Type: Other
Operating System: Windows 95/98/NT
PHP Version: 3.0.16
New Comment:
you just descovered "variable variables"
http://www.php.net/manual/en/language.variables.variable.php
Previous Comments:
------------------------------------------------------------------------
[2000-04-05 20:32:15] DerMurx@gmx.de
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.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=4054&edit=1