On my everyday office work, I have to deal with different types of multidimensional array and sometime I flat them to single dimension for my work purpose. Most of the time I prefer call_user_func_array with with array_merge param. Actually I want to know how they internally work specially the ...
operator way and which method is faster?
<?php
$data = [[1, 2], [3], [4, 5]];
print '<pre>';
print_r(array_merge(... $data)); // [1, 2, 3, 4, 5];
print_r(call_user_func_array('array_merge',$data)); // [1, 2, 3, 4, 5];
print_r(array_reduce($data, 'array_merge', [])); // [1, 2, 3, 4, 5];