例如 php 中的以下语法如何表达
1
$var = "name";
$name = "Jobs";
echo ${$var} ; // Jobs
2
class obj{
var $name ;
//
}
$obj = new obj;
$obj->name = "Jobs" ;
$var = "name";
echo $obj->$var ; // Jobs
2
class obj{
var $name ;
//
}
class obj2{
var $var;
//
}
$obj = new obj;
$obj->name = "Jobs" ;
$obj2 = new obj2;
$obj2->var = "name" ;
echo $obj->{$obj2->var} ; // Jobs