Home > Backend Development > PHP Tutorial > php中foreach循环有关问题

php中foreach循环有关问题

WBOY
Release: 2016-06-13 11:16:50
Original
811 people have browsed it

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


------解决方案--------------------
echo啊,低级错误
------解决方案--------------------
<br />each "Value: " . $value . "<br>";//each换成echo<br />
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 . "
";
}
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