Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道如何获得一个由字符串和另一个变量组合而成的变量。
例子:
$var1 ch1 我想要最终变量的名称,如下所示 $ch1var1
谢谢你。
$var1 = "Hello"; $nbr = "var"; $id = 1; echo ${$nbr.$id};
演示视图
使用 var 连接
echo ${$some . $combination . $of . $variables . "or" . "strings"};