php merge arrays

前端 未结 6 1659
北海茫月
北海茫月 2021-01-21 08:33

I have been trying (unsuccessfully) to merge the output of multiple arrays into a single array. An example of what I tried was:

$data1 = array(\"cat\", \"goat\")         


        
6条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-21 08:50

    using array_merge_recursive ::

    $arr1 = array("Item One");
    $arr2 = array("Item Two");
    print_r(array_merge_recursive($arr1, $arr2));
    

    outputs

    Array ( [0] => Item One [1] => Item Two ) 
    

提交回复
热议问题