2017-01-30 128 views
-1

如何將這些數組組合成一個數組?沒有循環? 和在哪裏在MySQL?如何將這些數組合併成一個數組?

Array 
(
    [0] => Array 
     (
      [0] => 82 
      [1] => 115 
      [2] => 116 
      [3] => 117 
      [4] => 118 
      [5] => 119 
      [6] => 120 
      [7] => 121 
      [8] => 122 
      [9] => 123 
      [10] => 124 
      [11] => 125 
      [12] => 126 
      [13] => 127 
      [14] => 128 
      [15] => 129 
      [16] => 130 
      [17] => 131 
      [18] => 132 
      [19] => 133 
     ) 

    [1] => Array 
     (
      [0] => 83 
      [1] => 134 
      [2] => 135 
      [3] => 136 
      [4] => 137 
      [5] => 138 
      [6] => 139 
      [7] => 140 
      [8] => 141 
      [9] => 142 
      [10] => 143 
      [11] => 144 
      [12] => 145 
     ) 

    [2] => Array 
     (
      [0] => 84 
      [1] => 146 
      [2] => 147 
      [3] => 148 
      [4] => 149 
      [5] => 150 
      [6] => 151 
      [7] => 152 
      [8] => 153 
      [9] => 154 
      [10] => 155 
      [11] => 156 
      [12] => 157 
      [13] => 158 
      [14] => 159 
      [15] => 160 
      [16] => 161 
      [17] => 162 
      [18] => 163 
      [19] => 164 
      [20] => 165 
     ) 

) 
+0

use array_merge http://php.net/manual/en/function.array-merge.php –

+2

不要一遍又一遍地重複相同的事情。描述你的問題並展示你的代碼。 '在哪裏在mysql' ...什麼mysql?這只是一個陣列.. – chris85

回答

2

試試這個:

$array = your array 

$result = call_user_func_array('array_merge', $array); 

echo "<pre>"; 
print_r($result); 
0

您必須使用陣列合併。

這裏的語法:array array_merge (array $array1 [, array $... ])

不過,記得有與此一定的規則。相同的字符串值將被覆蓋並且相同的數值將被附加。

相關問題