我在php中运行了for循环,我得到了以下输出... 我试图将第一个值存储在其他数组中,第二个值存储在其他数组中...请任何人指导我这样做!
或者我如何以二维数组存储
Array ( [0] => 44 [1] => 810 ) Array ( [0] => 0 [1] => 280 ) Array ( [0] => 73 [1] => 279 ) Array ( [0] => 0 [1] => 278 ) Array ( [0] => 0 [1] => 277 ) Array ( [0] => 0 [1] => 276 ) Array ( [0] => 87 [1] => 840 ) Array ( [0] => 0 [1] => 275 ) Array ( [0] => 0 [1] => 274 ) Array ( [0] => 0 [1] => 273 ) Array ( [0] => 6 [1] => 271 ) Array ( [0] => 0 [1] => 272 ) Array ( [0] => 0 [1] => 269 ) Array ( [0] => 3 [1] => 267 ) Array ( [0] => 0 [1] => 268 ) Array ( [0] => 3 [1] => 259 ) Array ( [0] => 108 [1] => 124 ) Array ( [0] => 82 [1] => 239 ) Array ( [0] => 221 [1] => 238 ) Array ( [0] => 30 [1] => 160 ) Array ( [0] => 3 [1] => 161 ) Array ( [0] => 65 [1] => 168 ) Array ( [0] => 73 [1] => 169 ) Array ( [0] => 0 [1] => 170 ) Array ( [0] => 0 [1] => 248 ) Array ( [0] => 192 [1] => 226 ) Array ( [0] => 209 [1] => 222 ) Array ( [0] => 80 [1] => 223 ) Array ( [0] => 182 [1] => 273 ) Array ( [0] => 79 [1] => 183 ) Array ( [0] => 73 [1] => 184 ) Array ( [0] => 73 [1] => 185 ) Array ( [0] => 6 [1] => 186 ) Array ( [0] => 73 [1] => 187 ) Array ( [0] => 0 [1] => 188 ) Array ( [0] => 48 [1] => 270 ) Array ( [0] => 138 [1] => 190 ) Array ( [0] => 191 [1] => 370 ) Array ( [0] => 152 [1] => 192 ) Array ( [0] => 12 [1] => 200 ) Array ( [0] => 200 [1] => 210 ) Array ( [0] => 0 [1] => 213 ) Array ( [0] => 21 [1] => 212 ) Array ( [0] => 124 [1] => 214 ) Array ( [0] => 0 [1] => 215 ) Array ( [0] => 0 [1] => 216 ) Array ( [0] => 133 [1] => 217 ) Array ( [0] => 6 [1] => 260 ) Array ( [0] => 73 [1] => 285 ) Array ( [0] => 73 [1] => 284 ) Array ( [0] => 0 [1] => 283 ) Array ( [0] => 73 [1] => 286 ) Array ( [0] => 73 [1] => 287 ) Array ( [0] => 0 [1] => 288 ) Array ( [0] => 73 [1] => 289 ) Array ( [0] => 0 [1] => 290 ) Array ( [0] => 76 [1] => 291 ) Array ( [0] => 76 [1] => 292 ) Array ( [0] => 0 [1] => 293 ) Array ( [0] => 0 [1] => 294 ) Array ( [0] => 0 [1] => 295 ) Array ( [0] => 0 [1] => 296 ) Array ( [0] => 0 [1] => 297 ) Array ( [0] => 3 [1] => 298 ) Array ( [0] => 0 [1] => 299 ) Array ( [0] => 0 [1] => 300 ) Array ( [0] => 3 [1] => 301 )
答案 0 :(得分:4)
答案 1 :(得分:2)
这样的东西?
$first = array();
$second = array();
$sourceArray = //this is what you are looping over.
//Your loop
foreach($sourceArray as $array) {
$first[] = $array[0];
$second[] = $array[1];
}