1
我需要以最短的方式調用類似的變量。在PHP中調用字符串中的變量
$test = new stdClass();
$test->var0=0;
$test->var1=1;
$test->var2=2;
,現在我需要回聲在週期中的所有3個變量,而不是像這樣:
echo $test->var0;
echo $test->var1;
echo $test->var2;
我需要以最短的方式調用類似的變量。在PHP中調用字符串中的變量
$test = new stdClass();
$test->var0=0;
$test->var1=1;
$test->var2=2;
,現在我需要回聲在週期中的所有3個變量,而不是像這樣:
echo $test->var0;
echo $test->var1;
echo $test->var2;
也許使用數組? – jmattheis