PHP中多维数组的foreach遍历示例_PHP教程
程序员文章站
2022-05-11 08:54:04
...
复制代码 代码如下:
//声明一个三维数组
$info=array(
"user"=>array(
array(1,"zhangsan",20,"nan"),
array(2,"lisi",20,"nan"),
array(3,"wangwu",25,"nv")
),
"score"=>array(
array(1,100,98,95,96),
array(2,56,98,87,84),
array(3,68,75,84,79)
),
"connect"=>array(
array(1,'2468246',"salkh@bbs.com"),
array(2,'343681643',"aikdki@sina.com"),
array(3,'3618468',"42816@qq.com")
)
);
//循环遍历,输出一个表格
foreach($info as $tableName=>$table){
echo "
".$col." | ";
}
?>
上一篇: 有关重入的文章推荐10篇
下一篇: 链表树——复合数据结构应用实例