对你们来说可能是一个简单的问题。在谷歌上找不到它。
我正在尝试连接两个变量名称;
$i=0;
for ($i=0;$i<5;$i++){
if($array[$i]>0){
$test.$i=//do something
}else{
$test.$i=//do something
}
}
//echo $test0 gives me nothing.
//echo $test1 gives me nothing.
我知道我不能使用 $test.$i 但不知道该怎么做。有什么帮助吗?谢谢!
try ${$test.$i} = value
EDIT: http://php.net/manual/en/language.variables.variable.php
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)