Merge to arrays in PHP (2D)
i need to merge an 2d array, if possible without any loops. Is there any way to use those 2 Arrays:
$array1 = array(
0 => array('LABEL' => 'Label1'),
1 => array('LABEL' => 'Label2'),
2 => array('LABEL' => 'Label3'),
);
$array2 = array(
0 => array('LABEL' => 'Label1'),
1 => array('LABEL' => 'Label2'),
2 => array('LABEL' => 'Label4'),
);
and get this result:
$result = array(
0 => array('LABEL' => 'Label1'),
1 => array('LABEL' => 'Label2'),
2 =>开发者_开发百科 array('LABEL' => 'Label3'),
3 => array('LABEL' => 'Label4'),
);
$result = array_merge($array1, $array2);
And if you want no double results in the array, you could use the multidimensional array save function from the PHP comments here: http://www.php.net/manual/de/function.array-unique.php#97285
精彩评论