Interleaving multiple arrays into a single array

后端 未结 4 866
孤独总比滥情好
孤独总比滥情好 2020-11-27 22:04

I need to merge several arrays into a single array. The best way to describe what I\'m looking for is \"interleaving\" the arrays into a single array.

For example

4条回答
  •  自闭症患者
    2020-11-27 22:13

    I would just use array_merge(), but that obviously depends on what exactly you do.

    This would append those arrays to each other, while elements would only be replaced when they have the same non-numerical key. And that might not be a problem for you, or it might be possible to be solved because of attribute order, since the contents of the first arrays' elements will be overwritten by the later ones.

提交回复
热议问题