PHP三维数组转二维数组
<?php
$result = array(
0 => array(
0 => array(
'id' => 1,
'name' => '黄一',
),
1 => array(
'id' => 2,
'name' => '黄二',
),
),
1 => array(
0 => array(
'id' => 3,
'name' => '黄三',
),
1 => array(
'id' => 4,
'name' => '黄四',
),
)
);
echo "<pre>";var_dump($result);
echo "<br />";
$arr2=array();
// 循环遍历三维数组$arr3
foreach($result as $value){
foreach($value as $v){
$arr2[]=$v;
}
}
// 销毁$arr3
unset($result,$value,$v);
echo "<br /s>";
echo "第二种方法:";
echo "<pre>";var_dump($arr2);
?>