Weird.
| From: | John Coggeshall | Date: | Wed, 14 Jan 2004 09:33:13 +0000 |
| Subject: | Weird. | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-7088@lists.php.net to get a copy of this message | ||
I know that this issue to some extent or another has been brought up
before, but I just wanted to make sure that this is really how things
are supposed to work... Apparently the statements setting B C and D
are all equivalent.
This could be absolutely bogus, but I thought maybe someone could
explain briefly why if it is :)
John
<?php
class weird {
var $myvar;
function __construct() {
$this->myvar = "A";
$this->$myvar = "B";
$this->${'myvar'} = "C";
$this->${'$myvar'} = "D";
echo 'this->myvar: '.$this->myvar."\n";
echo 'this->$myvar: '.$this->$myvar."\n";
echo 'this->${\'myvar\'}:
'.$this->${'myvar'}."\n";
echo 'this->${\'$myvar\'}:
'.$this->${'$myvar'}."\n";
echo 'this->$$$$$$$myvar: '.$this->$$$$$$$myvar."\n";
echo 'this->$$$$$$${\'$$$myvar\'}: ' .
$this->$$$$$$${'$$$myvar'}."\n";
}
}
?>
--
-=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=-
John Coggeshall http://www.coggeshall.org/
The PHP Developer's Handbook http://www.php-handbook.com/
-=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=-