关于合并二维数组的问题
有一个数组:
Array
(
[0] => Array
(
[a] => Array
(
[id] => 4
)
)
[1] => Array
(
[a] => Array
(
[id] => 5
)
)
[2] => Array
(
[b] => Array
(
[id] => 4
)
)
[3] => Array
(
[b] => Array
(
[id] => 7
)
)
)
请问如何合并成
Array(
[0]=>4
[1]=>5
[2]=>4
[3]=>7
)
value都是二维数组id
------解决思路----------------------
$arr = Array<br />(<br /> '0' => Array<br /> (<br /> 'a' => Array<br /> (<br /> 'id' => 4<br /> )<br /><br /> ),<br /><br /> '1' => Array<br /> (<br /> 'a' => Array<br /> (<br /> 'id' => 5<br /> )<br /><br /> ),<br /><br /> '2' => Array<br /> (<br /> 'b' => Array<br /> (<br /> 'id' => 4<br /> )<br /><br /> ),<br /><br /> '3' => Array<br /> (<br /> 'b' => Array<br /> (<br /> 'id' => 7<br /> )<br /><br /> )<br /><br />);<br />$new_arr = array();<br />foreach($arr as $vl){<br /> foreach($vl as $v) $new_arr[] = $v['id'];<br />}<br />print_r($new_arr);
$a = array (<br> 0 => <br> array (<br> 'a' => <br> array (<br> 'id' => '4',<br> ),<br> ),<br> 1 => <br> array (<div class="clear"> </div>