lang/php/ VariableVariableNames
<?php
class A {
function __construct() {
$this->a = "hello";
}
}
$a = new A();
$c = "b";
$a->$c = "mrflibble"; # we can assign to instances of a class
$x = "a";
echo $a->$x; # we can use a variable as the name of the member
echo "\n";
echo $a->b;
echo "\n";