php多维数组
<?php //关联数组方法 $list=array( array('name' =>"zhangsan",'age'=>20,'sex'=>"m"), array('name' =>"lishi",'age'=>21,'sex'=>"w"), array('name' =>"wangwu",'age'=>21,'sex'=>"w"), ); echo"<pre>"; print_r($list); echo"</pre>"; echo"<table>"; echo"<tr><th>name</th><th>age</th><th>sex</th></tr>"; echo"<tr>"; //使用foreach($arg1 as $arg2)遍历数组 foreach($list as $stu){ echo"<tr>"; echo"<td>".$stu['name']."</td>"; echo"<td>".$stu['sex']."</td>"; echo"<td>".$stu['age']."</td>"; echo"</tr>"; } echo"</tr>"; echo"</table>";
注:
=> 是数组成员访问符号
-> 是对象成员访问符号
if you don't try,you will never know!