101这样的语法称为Variable Variable.
$real_variable = 'test';
$name = 'real_variable';
echo $$name;
您将获得以下输出:
test
这里:
$real_variable
包含测试$name
包含您的变量的名称:'real_variable'
$$name
mean "the variable thas has its name contained in $name
"
$real_variable
'test'
EDIT after @Jhonny's comment :
做$$$
分?
那么,让我们试试这部分代码:
$real_variable = 'test';
$name = 'real_variable';
$name_of_name = 'name';
echo $name_of_name . '<br />';
echo $$name_of_name . '<br />';
echo $$$name_of_name . '<br />';
以下是我得到的结果:
name
real_variable
test
所以,我想说,yes, you can do 100;-)