a::merge($array1, $array2)

Merges arrays recursively

  • $array1 (array)
  • $array2 (array)
  • return (array)

Example

<?php
$array1 = array(
  1 => 'cat',
  2 => 'dog',
  3 => 'bird',
);

$array2 = array(
  'a' => 'elephant',
  'b' => 'kangaroo',
  'c' => 'hippopotamus',
);
$merged = a::merge($array1, $array2);

var_dump($merged);

Result:

array
  1   =>  'cat'
  2   =>  'dog'
  3   =>  'bird'
  'a' =>  'elephant'
  'b' =>  'kangaroo'
  'c' =>  'hippopotamus'