84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
foreach 可以遍历数组与对象,它会把当前单元的键名也会在每次循环中被赋给变量 $key,值赋给变量$val,例如 $row=array('one'=>1,'two'=>2);foreach($row as $key=>$val){ echo $key.'--'.$val;}第一次遍历的$key是one,$val是1;第二次遍历的$key是two,$val是2;
foreach 可以遍历数组与对象,它会把当前单元的键名也会在每次循环中被赋给变量 $key,值赋给变量$val,例如
$row=array('one'=>1,'two'=>2);
foreach($row as $key=>$val){
echo $key.'--'.$val;
}
第一次遍历的$key是one,$val是1;
第二次遍历的$key是two,$val是2;