Asked 7 years ago
20 Dec 2016
Views 2241
noob

noob posted

how to multidimensional array merge in php

how to merge two multidimensional array in one by array_merge ,
is it work as it is work with flat array ?
Mitul Dabhi

Mitul Dabhi
answered Nov 30 '-1 00:00

it is simple array_merge .
it work same as single dimensional array with array_merge.

$records = array(
  1=>array(1,2)
);
$record2 = array(
 2=>array(3,4)
);
$data=array_merge($records,$record2);
print_r($data);


it is reset key to first level.
Post Answer