The printed result is multiple arrays of the same level. for the first time, you can see that you want to merge them into a large array to facilitate the {code...} operation ...} the printed result is multiple same-level arrays. for the first time, you can see that you want to merge them into a large array to facilitate operations.
Array ([0] => Array ([title] => Yueda travel) [1] => Array ([title] => A game is good) [2] => Array ([title] => traveling companion) [3] => Array ([title] => Housing Market) [4] => Array ([title] => ---) [5] => Array ([title] => Fly With Me) [6] => Array ([title] => Mu Xi homestay) [7] => Array ([title] => traveling with a companion pet) [8] => Array ([title] => Japanese Deep Learning Network) [9] => Array ([title] => cloud game live broadcast )) array ([0] => Array ([title] => Youbi travel) [1] => Array ([title] => Fast Trip) [2] => Array ([title] => Independent Day travel) [3] => Array ([title] => BInkky chuangsihanyu) [4] => Array ([title] => squid travel) [5] => Array ([title] => note YOKI) [6] => Array ([title] => Yu Youbang) [7] => Array ([title] => 23 place) [8] => Array ([title] => Youhui) [9] => Array ([title] => ouyo travel ))
Reply content:
The printed result is multiple same-level arrays. for the first time, you can see that you want to merge them into a large array to facilitate operations.
Array ([0] => Array ([title] => Yueda travel) [1] => Array ([title] => A game is good) [2] => Array ([title] => traveling companion) [3] => Array ([title] => Housing Market) [4] => Array ([title] => ---) [5] => Array ([title] => Fly With Me) [6] => Array ([title] => Mu Xi homestay) [7] => Array ([title] => traveling with a companion pet) [8] => Array ([title] => Japanese Deep Learning Network) [9] => Array ([title] => cloud game live broadcast )) array ([0] => Array ([title] => Youbi travel) [1] => Array ([title] => Fast Trip) [2] => Array ([title] => Independent Day travel) [3] => Array ([title] => BInkky chuangsihanyu) [4] => Array ([title] => squid travel) [5] => Array ([title] => note YOKI) [6] => Array ([title] => Yu Youbang) [7] => Array ([title] => 23 place) [8] => Array ([title] => Youhui) [9] => Array ([title] => ouyo travel ))
Array_column, php version requires 5.5 +
$ Arr1 = Array ('title' => 'Happy traveling out',), Array ('title' => 'A Good Game ',)); $ arr2 = Array ('title' => 'youbi travel',), Array ('title' => 'kuaiyou ',)); var_dump (array_merge (array_column ($ arr1, 'title'), array_column ($ arr2, 'title'); array (4) {[0] => string (15) "Yueda travel" [1] => string (10) "A tour is good" [2] => string (12) "Youbi travel" [3] => string (12) ""}
Use the array_merge method
array_map(function($v){ return $v['title']; }, $arr);
Assume that the preceding two 2D arrays are $ arr1 and $ arr2.
First, use the array_column () function to obtain the values of two-dimensional array columns (),
The values of the 'title' field in the two arrays are obtained in two anonymous index arrays.
Array_column ($ arr1, 'title ');
Then use the array_merge () array merging function to merge the two arrays:
$ New_arr = array_merge (array_column ($ arr1, 'title'), array_column ($ arr2, 'title '));