fork download
  1. <?php
  2.  
  3. // your code goes here
  4.  
  5. function my_array_merge($array) {
  6. $result = [];
  7. foreach($array as $subArray) {
  8. $result = array_merge($result, $subArray);
  9. }
  10. return $result;
  11. }
  12.  
  13. $a = [];
  14. $a['one'] = [1,2,3];
  15. $a['two'] = [4,5,6];
  16. print_r(my_array_merge($a));
Success #stdin #stdout 0.03s 52480KB
stdin
Standard input is empty
stdout
Array
(
    [0] => 1
    [1] => 2
    [2] => 3
    [3] => 4
    [4] => 5
    [5] => 6
)