This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center。
7年前关闭。
我认为这是一个简单的问题。但是我做不完。请帮助我解决这个简单的问题。我想从数组使用循环中获取值。
这是我的代码
它不起作用:(
在我将$ i标记为变量之前,您错过了$。
7年前关闭。
我认为这是一个简单的问题。但是我做不完。请帮助我解决这个简单的问题。我想从数组使用循环中获取值。
这是我的代码
<?for ($i = 1 ; $i <=5 ; $i++){
$foo = array(1,2,3,4,5);
echo $foo[i];
}
?>
它不起作用:(
最佳答案
用这个
$foo = array(1,2,3,4,5);
echo $foo[$i];
在我将$ i标记为变量之前,您错过了$。