# 新人求教！多维数组合并的问题

array

(

[0] => array

(

[statusa] => 1

[laiyuan] => 287

[stotala] => 148

)

array

(

[0] => array

(

[status] => 1

[laiyuan] => 287

[stotal] => 148

)

array

(

[0] => array

(

[status] => 1

[statusa] => 1

[laiyuan] => 287

[stotal] => 148

[stotala] => 148

)

\$a = array(
array(
‘statusa’ => 1,
‘laiyuan’ => 287,
‘stotala’ => 148,
)
);
\$b = array(
array(
‘status’ => 1,
‘laiyuan’ => 287,
‘stotal’ => 148,
)
);
\$c = array_map(‘array_merge’, \$a, \$b);
print_r(\$c);

array
(
[0] => array
(
[statusa] => 1
[laiyuan] => 287
[stotala] => 148
[status] => 1
[stotal] => 148
)
)

array
(
[0] => array
(
[status] => 0
[laiyuan] => 287
[stotal] => 26
)
[1] => array
(
[status] => 0
[laiyuan] => 288
[stotal] => 2
)
[2] => array
(
[status] => 0
[laiyuan] => 289
[stotal] => 17
)
[3] => array
(
[status] => 0
[laiyuan] => 290
[stotal] => 1
)
[4] => array
(
[status] => 0
[laiyuan] => 356
[stotal] => 2
)
[5] => array
(
[status] => 0
[laiyuan] => 370
[stotal] => 6
)
)

array
(
[0] => array
(
[statusa] => 1
[laiyuan] => 287
[stotala] => 148
)
[1] => array
(
[statusa] => 1
[laiyuan] => 288
[stotala] => 7
)
[2] => array
(
[statusa] => 1
[laiyuan] => 289
[stotala] => 168
)
[3] => array
(
[statusa] => 1
[laiyuan] => 290
[stotala] => 1
)
[4] => array
(
[statusa] => 1
[laiyuan] => 294
[stotala] => 8
)
[5] => array
(
[statusa] => 1
[laiyuan] => 356
[stotala] => 11
)
[6] => array
(
[statusa] => 1
[laiyuan] => 370
[stotala] => 21
)
[7] => array
(
[statusa] => 1
[laiyuan] => 383
[stotala] => 1
)
)

array
(
[0] => array
(
[status] => 0
[laiyuan] => 287
[stotal] => 26
[statusa] => 1
[stotala] => 148
)
[1] => array
(
[status] => 0
[laiyuan] => 288
[stotal] => 2
[statusa] => 1
[stotala] => 7
)
[2] => array
(
[status] => 0
[laiyuan] => 289
[stotal] => 17
[statusa] => 1
[stotala] => 168
)
[3] => array
(
[status] => 0
[laiyuan] => 290
[stotal] => 1
[statusa] => 1
[stotala] => 1
)
[4] => array
(
[status] => 0
[laiyuan] => 294
[stotal] => 2
[statusa] => 1
[stotala] => 8
)
[5] => array
(
[status] => 0
[laiyuan] => 356
[stotal] => 6
[statusa] => 1
[stotala] => 11
)
[6] =>
[7] =>
)

[6] => array
(
[statusa] => 1
[laiyuan] => 370
[stotala] => 21
)

array_merge 要求规模一样

laiyuan stotala stotal

array

(

[0] => array

(

[status] => 0

[laiyuan] => 287

[stotal] => 26

)

[1] => array

(

[status] => 0

[laiyuan] => 288

[stotal] => 2

)

[2] => array

(

[status] => 0

[laiyuan] => 289

[stotal] => 17

)

[3] => array

(

[status] => 0

[laiyuan] => 290

[stotal] => 1

)

[4] => array

(

[status] => 0

[laiyuan] => 356

[stotal] => 2

)

[5] => array

(

[status] => 0

[laiyuan] => 370

[stotal] => 6

)

[6] => array

(

)

[7] => array

(

)

)

Posted in 未分类