将2个数组合并为1

时间:2017-02-23 20:29:02

标签: php arrays

如果我有这样的数组:

$array = Array( 
    array(
        [a] => something, 
        [b] => something
    )
)

然后我有另一个数组相同,如果我想将它们组合起来创建一个这样的数组:

Array( 
    [0] => Array( 
        [a] => something, 
        [b] => something
    )
    [1] => Array( 
        [a] => something, 
        [b] => something
    )
)

我怎样才能实现这一目标?我以为使用array_merge会有所帮助但是这给了我:

Array( 
    [0] => Array( 
        [a] => something, 
        [b] => something
    )
    [1] => something, 
    [2] => something
    )
)

0 个答案:

没有答案