动态变量的常数等价物

I can access static class variables without using dangerous eval like

$aa = icon;
echo StaticClass::chat{$aa}; 

equivalent is :
constant("StaticClass::chat$aa")

however i have no idea how to do the same if staticClass is not static.

i.e need to accesss

$StaticClass->get$aafunc(); // geticonfunc()

Pleas help ?

What about this :

<?php

class test {
    public static $xyz = "static xyz content";

    public static function foo() {
        return "result of static foo function";
    }

    public $wxyz = "wxyz content";

    public function bar() {
        return "result of bar method";
    }
}

$xyzName  = "xyz";
$fooName  = "foo";
$wxyzName = "wxyz";
$barName  = "bar";

$instance = new test();

echo (test::$$xyzName)."<br />";
echo (test::$fooName())."<br />";
echo ($instance->$wxyzName)."<br />";
echo ($instance->$barName())."<br />";

?>

It returns :

static xyz content<br />
result of static foo function<br />
wxyz content<br />
result of bar method<br />