How can i reference a class property knowing only a string?
class Foo
{
public $bar;
public function TestFoobar()
{
$this->foobar( bar );
}
public function foobar($string)
{
echo $this->$$string; //doesn t work
}
}
评估字符串的正确方法是什么?