我有以下数组:
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;
}
任何帮助将不胜感激。