array怎样合并成这样,帮忙
<form action="A.php" method="POST">
<table>
<tr>
<td><input type="text" name="id[]" value="1"></td>
<td><input type="text" name="title[]" value="aaa"></td>
<td><input type="text" name="name[]" value="abc"></td>
</tr>
<tr>
<td><input type="text" name="id[]" value="2"></td>
<td><input type="text" name="title[]" value="bbb"></td>
<td><input type="text" name="name[]" value="def"></td>
</tr>
<tr>
<td><input type="text" name="id[]" value="3"></td>
<td><input type="text" name="title[]" value="ccc"></td>
<td><input type="text" name="name[]" value="ghi"></td>
</tr>
</table>
<input type="submit">
</form>
A.PHP
想结果是这样,请帮忙array怎样合并成这样
$arr=array(
array('id'=>'1','title'=>'aaa','name'=>'abc'),
array('id'=>'2','title'=>'bbb','name'=>'def'),
array('id'=>'3','title'=>'ccc','name'=>'ghi')
);
[解决办法]
$ar1=$_POST['id'];
$ar2=$_POST['title'];
$ar3=$_POST['name'];
for($i=0;$i<count($ar1);$i++){
$arr[]=array('id'=>$ar1[$i],'title'=>$ar2[$i],'name'=>$ar3[$i]);
}
print_r($arr);