<?php
//for循环的嵌套可以用来遍历下标连续的索引二维数组
$contact=array(
array(1,"高某","A公司","北京市",'010-98765432',"aaa@gao.com"),
array(2,"洛某","B公司","上海市","020-26468545","bbb@luo.com"),
array(3,"峰某","C公司","天津市","030-46546185","ccc@feng.com")
);
echo "<table width='800' align='center' border='10'>";
echo "<caption><h1>for循环输出二维数组</h1></caption>";
echo "<tr>";
echo "<th>ID</th>";
echo "<th>姓名</th>";
echo "<th>公司</th>";
echo "<th>地址</th>";
echo "<th>电话</th>";
echo "<th>Email</th>";
echo "</tr>";
$num1=count($contact);
for($i=0;$i<$num1;$i++){
echo "<tr align='center'>";
$num2=count($contact[0]);
for($j=0;$j<$num2;$j++){
echo "<td>{$contact[$i][$j]}</td>";
}
echo "</tr>";
}
echo "</table>";
?>