php中foreach循环有关问题
时间:2021-07-01 10:21:17
帮助过:1人阅读
php中foreach循环问题
我按着书本的例子,可是运行的时候提示错误
$arr = array("CRONALDO", "KAKA", "OZIL");
foreach($arr as $value)
{
each "Value: " . $value . "
";
}
提示这行 each "Value: " . $value . "
"; 出错,是什么原因呢?怎样才能正确输出
------解决方案--------------------echo啊,低级错误
------解决方案--------------------
each "Value: " . $value . "
";//each换成echo
------解决方案--------------------代码改成:
$arr = array("CRONALDO", "KAKA", "OZIL");
foreach($arr as $value)
{
echo "Value: " . $value . "
";
}