How can I merge PHP arrays?

前端 未结 10 1846
盖世英雄少女心
盖世英雄少女心 2020-12-20 12:43

I have two arrays of animals (for example).

$array = array(
    array(
        \'id\' => 1,
        \'name\' => \'Cat\',
    ),
    array(
        \'id         


        
10条回答
  •  不知归路
    2020-12-20 13:36

    I would rather prefer array_splice over array_merge because of its performance issues, my solution would be:

    
    

提交回复
热议问题