How can you combine two arrays?

后端 未结 6 1404
慢半拍i
慢半拍i 2020-12-12 08:15

They are simplified as follows which is enough for this question. This question is based on this answer.

1

[a][b][]

and

2

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-12 09:06

    for($i = 0; $i < sizeof($array); $i++)
    {
         $mergedarray[a][b] = $a[a][b];
         $mergedarray[a][c] = $b[a][c];
    }
    

    as far as i can tell this is what you want, that way both the sub-keys have the same root key.

提交回复
热议问题