note 25023 added to language.variables.variable
| From: | jupp-mueller at t-online dot de | Date: | Sun, 08 Sep 2002 11:29:22 +0000 |
| Subject: | note 25023 added to language.variables.variable | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-36333@lists.php.net to get a copy of this message | ||
I found another undocumented/cool feature: variable member variables in classes. It's pretty
easy:
class foo {
function bar() {
$bar1 = "var1";
$bar2 = "var2";
$this->{$bar1}= "this ";
$this->{$bar2} = "works";
}
}
$test = new foo;
$test->bar();
echo $test->var1 . $test->var2;
--
http://www.php.net/manual/en/language.variables.variable.php
http://master.php.net/manage/user-notes.php?action=edit+25023
http://master.php.net/manage/user-notes.php?action=delete+25023
http://master.php.net/manage/user-notes.php?action=reject+25023