php中foreach循环问题

WBOY
Release: 2016-06-23 14:02:33
Original
766 people have browsed it

我按着书本的例子,可是运行的时候提示错误
$arr = array("CRONALDO", "KAKA", "OZIL");
foreach($arr as $value)
{
each "Value: " . $value . "
";
}
提示这行 each "Value: " . $value . "
"; 出错,是什么原因呢?怎样才能正确输出


回复讨论(解决方案)

echo啊,低级错误

each "Value: " . $value . "<br>";//each换成echo
Copy after login

我按着书本的例子,可是运行的时候提示错误
$arr = array("CRONALDO", "KAKA", "OZIL");
foreach($arr as $value)
{
each "Value: " . $value . "
";
}
提示这行 each "Value: " . $value . "
"; 出错,是什么原因呢?怎样才能正确输…… 代码改成:
$arr = array("CRONALDO", "KAKA", "OZIL");
foreach($arr as $value)
{
echo "Value: " . $value . "
";
}

echo啊,低级错误
哎,看到了,的确是低级错误!

引用 1 楼 snmr_com 的回复:echo啊,低级错误
哎,看到了,的确是低级错误!

几乎每个人都必经的,你算好了,我当年一个半角分号打成全角分号,查了2个小时……

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template