note 9181 added to Variable variables
| From: | kristi_shoemakerDONT_LIKE_SPAM at mail dot com | Date: | Fri, 20 Oct 2000 23:35:33 +0000 |
| Subject: | note 9181 added to Variable variables | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-6772@lists.php.net to get a copy of this message | ||
If varialbe array name names work why not variable object names?
For example:
class Schlemiel {
var $aVar = "foo";
}
$schlemazel[5] = "oof";
$schlemiel = new Schlemiel;
$a = "schlemiel";
$b = "schlemazel";
echo "This works: ".${$b}[5]."<BR>";
echo "So does this: ".$schlemiel->aVar."<BR>";
echo "But this doesn't: ".${$a}->aVar."<BR>";
echo "Nor does this: ".${"schlemiel"}->aVar."<BR>";
Thanks,
-kristi
http://www.php.net/manual/language.variables.variable.php