<?php $stu=array(array(76,87,68), array(65,89,95), array(90,80,66), array(90,95,65)); //定义一个二维数组 foreach($stu as $k=>$v){ //遍历数组 echo "元素{$k}中的元素:<br />"; foreach($v as $k=>$v){ echo " {$k}=>{$v}"; //输出数组的索引/值对 } echo '<br />'; } ?>
<?php $stu=array(array(76,87,68), array(65,89,95), array(90,80,66), array(90,95,65)); //定义一个二维数组 foreach($stu as $k=>$v){ //遍历数组 echo "元素{$k}中的元素:<br />"; foreach($v as $k=>$v){ echo " {$k}=>{$v}"; //输出数组的索引/值对 } echo '<br />'; } ?>