从头开始看手册,看到有关 continue代码如下<?php
while (list ($key, $value) = each($arr)) {
if (!($key % 2)) { // skip odd members
continue;
}
do_something_odd($value);
}$i = 0;
while ($i++ < 5) {
echo "Outer<br />\n";
while (1) {
echo " Middle<br />\n";
while (1) {
echo " Inner<br />\n";
continue 3;
}
echo "This never gets output.<br />\n";
}
echo "Neither does this.<br />\n";
}
?> 但运行时出错Warning: Variable passed to each() is not an array or object in G:\web\shop2\web\test\4.php on line 3
Outer
Middle
Inner
Outer
Middle
Inner
Outer
Middle
Inner
Outer
Middle
Inner
Outer
Middle
Inner
我对 while (list ($key, $value) = each($arr)) {不太理解,因为这段代码中上下文中都没定义$arr请前辈对这个例子加以解释指导,谢谢
while (list ($key, $value) = each($arr)) {
if (!($key % 2)) { // skip odd members
continue;
}
do_something_odd($value);
}$i = 0;
while ($i++ < 5) {
echo "Outer<br />\n";
while (1) {
echo " Middle<br />\n";
while (1) {
echo " Inner<br />\n";
continue 3;
}
echo "This never gets output.<br />\n";
}
echo "Neither does this.<br />\n";
}
?> 但运行时出错Warning: Variable passed to each() is not an array or object in G:\web\shop2\web\test\4.php on line 3
Outer
Middle
Inner
Outer
Middle
Inner
Outer
Middle
Inner
Outer
Middle
Inner
Outer
Middle
Inner
我对 while (list ($key, $value) = each($arr)) {不太理解,因为这段代码中上下文中都没定义$arr请前辈对这个例子加以解释指导,谢谢
解决方案 »
- php如何保存文件到客户端?
- 请问php如果测试链接速度
- 谁搞个新浪体育直播间的简易版本挖
- 在 WindowsXP + PHP5 + Apache2 环境中连接 PostgreSQL 时错误,如何如何解决?
- PHP上传大文件
- 问一个关于分页的问题...
- 用php将文本文件的内容定时输入到mysql数据库中?
- 使用ADO如何列出指定数据库中所有的表
- 大侠们来帮帮忙!
- 4.用一句话给以下每个函数写一个“功能描述”(需查手册): 字符串函数: 输出与格式化:echo , print, printf, print_r, var_
- 图片怎么是挨个显示的?header('Content-Type: image/jpeg');readfile($file);
- 请问这段代码是什么 意思?
即无条件死循环
谢谢 那0 就是false了 ,,,请帮忙解析一下1楼中代码while (list ($key, $value) = each($arr)) {
$arr没有定义的问题。。
$arr = array('0'=> 'a','1'=> 'b','2'=> 'c','3'=> 'd'); while (list ($key, $value) = each($arr)) {
if (!($key % 2)) { // skip odd members
continue;
}
echo "$key => $value <br />";//改动一下打印出来
}
/*你将得到
1 => b
3 => d
list就是遍历,通常都是配合while一起出现,跟foreach你可以结合起来,建议看看手册
不过还有稍复杂些的用法,看手册吧,比这里得到答案更好
*/