回显 $test 的结果
Echo the Result of $test
<?php
$j7=6;
$b=7;
$test= '$j'.$b;
echo $test;
?>
如何让echo $test的结果是6而不是$j7?
您要执行以下操作:
$test = "${'j'.$b}";
echo $test; //Outputs 6
您正在使用 variable variables,它本质上是根据另一个变量的内容定义一个变量。
<?php
$j7=6;
$b=7;
$test= '$j'.$b;
echo $test;
?>
如何让echo $test的结果是6而不是$j7?
您要执行以下操作:
$test = "${'j'.$b}";
echo $test; //Outputs 6
您正在使用 variable variables,它本质上是根据另一个变量的内容定义一个变量。