Home  >  Article  >  Backend Development  >  array怎样合并成这样,帮忙,该怎么处理

array怎样合并成这样,帮忙,该怎么处理

WBOY
WBOYOriginal
2016-06-13 10:07:46972browse

array怎样合并成这样,帮忙























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 $arr[]=array('id'=>$ar1[$i],'title'=>$ar2[$i],'name'=>$ar3[$i]);
}
print_r($arr);
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn