I have two arrays that need to be merged. I can loop through each array and merge manually. But, Is there a built in function to do this?
Array 1:
Array
(
[0] => Array
(
[detail_image_id] => 6389
[product_name] => Starter broadband Package
)
[1] => Array
(
[detail_image_id] => 6358
[product_name] => Starter broadband Package
)
)
Array 2:
Array
(
[0] => Array
(
[detail_image_id] => 6358
[guid] => http://xxx/wp-content/uploads/2018/04/broadband-4mbs-wingle.jpg
)
[1] => Array
(
[detail_image_id] => 6389
[guid] => http://xxx/wp-content/uploads/2018/04/broadband-4mbs-charji.jpg
)
)
Expected Output array is:
Array
(
[0] => Array
(
[detail_image_id] => 6389
[product_name] => Starter broadband Package
[guid] => http://xxx/wp-content/uploads/2018/04/broadband-4mbs-charji.jpg
)
[1] => Array
(
[detail_image_id] => 6358
[product_name] => Starter broadband Package
[guid] => http://xxx/wp-content/uploads/2018/04/broadband-4mbs-wingle.jpg
)
)
I have added only a sample from the array. Array is huge. Is there any PHP functions like array_merge()
or array_map()
that we can use instead of manual for loops and iterators?