數組我有以下陣列:創建多維數組
array (size=2)
0 =>
array (size=4)
0 => string 'http://localhost/wp/wp-content/uploads/2013/03/slider-area.jpg' (length=62)
1 => int 1584
2 => int 346
3 => boolean false
1 =>
array (size=4)
0 => string 'http://localhost/wp/wp-content/uploads/2013/03/featured.jpg' (length=59)
1 => int 1584
2 => int 346
3 => boolean false
我的問題是,我怎麼能遍歷這個數組生成一個只包含兩個值如下一個新的數組:
$result_array = array(0 => "http://localhost/wp/wp-content/uploads/2013/03/slider-area.jpg",
1 => "http://localhost/wp/wp-content/uploads/2013/03/featured.jpg");
我已經嘗試了一個foreach循環,但無法獲得所需的結果數組。我試過以下循環:
foreach ($array as $key => $value){
foreach ($value as $item){
$result_array[] = $item;
}
任何幫助將不勝感激。
非常感謝老兄! – Mark