关于二维数组。
<?php<br /> $group1 = array(<br /> ("name"=>"zs","age"=>"10","sex"=>"nan"),<br /> ("name"=>"zs","age"=>"10","sex"=>"nan"),<br /> ("name"=>"zs","age"=>"10","sex"=>"nan"),<br /> ("name"=>"ls","age"=>"11","sex"=>"nan"),<br /> ("name"=>"ww","age"=>"12","sex"=>"nv"),<br /> ("name"=>"ls","age"=>"11","sex"=>"nan"),<br /> ("name"=>"ww","age"=>"12","sex"=>"nv"),<br /> ("name"=>"ls","age"=>"11","sex"=>"nan"),<br /> ("name"=>"ww","age"=>"12","sex"=>"nv")<br /> );<br /><br /> echo '<table border="1" width="800" align>';<br /> echo '<caption><h1>数组转化为表格</h1><caption>';<br /><br /> foreach( $group as $row ){<br /> echo '<tr>';<br /> foreach( $row as $col ){<br /> echo '<td>{$col}</td>';<br /> }<br /> echo '</tr>';<br /> }<br /> echo '</table>';<br />?><br />
$group = array(<br /> array("name"=>"zs","age"=>"10","sex"=>"nan"),<br /> array("name"=>"zs","age"=>"10","sex"=>"nan"),<br /> array("name"=>"zs","age"=>"10","sex"=>"nan"),<br /> array("name"=>"ls","age"=>"11","sex"=>"nan"),<br /> array("name"=>"ww","age"=>"12","sex"=>"nv"),<br /> array("name"=>"ls","age"=>"11","sex"=>"nan"),<br /> array("name"=>"ww","age"=>"12","sex"=>"nv"),<br /> array("name"=>"ls","age"=>"11","sex"=>"nan"),<br /> array("name"=>"ww","age"=>"12","sex"=>"nv")<br /> );<br /><br /> echo '<table border="1" width="800" align>';<br /> echo '<caption><h1>数组转化为表格</h1><caption>';<br /><br /> foreach( $group as $row ){<br /> echo '<tr>';<br /> foreach( $row as $col ){<br /> echo "<td>{$col}</td>";<br /> }<br /> echo '</tr>';<br /> }<br /> echo '</table>';<br />