PHP语言中for循环语句list(),each()函数以及多维数组应用出错
<html><head><title></title></head><body><h2></h2><?php$students=array(array("sno"=>"1...
<html>
<head>
<title></title>
</head>
<body>
<h2></h2>
<?php
$students=array(array("sno"=>"1","sname"=>"xw","sex"=>"男"),
array("sno"=>"2","sname"=>"xw","sex"=>"女"));
for($row=0;$row<3;$row++)
{
while (list($key,$value)=each(&students[$row])) {
echo $value;
}
echo"<br>";
}
?>
</body>
<html>
请问是哪里出错了 展开
<head>
<title></title>
</head>
<body>
<h2></h2>
<?php
$students=array(array("sno"=>"1","sname"=>"xw","sex"=>"男"),
array("sno"=>"2","sname"=>"xw","sex"=>"女"));
for($row=0;$row<3;$row++)
{
while (list($key,$value)=each(&students[$row])) {
echo $value;
}
echo"<br>";
}
?>
</body>
<html>
请问是哪里出错了 展开
1个回答
展开全部
$students = array(array("sno" => "1", "sname" => "xw", "sex" => "男"),
array("sno" => "2", "sname" => "xw", "sex" => "女"));
for ($row = 0; $row < count($students); $row++) {
while (list($key, $value) = each($students[$row])) {
echo $value;
}
echo"<br>";
}
变量写错了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询