- array_merge: documentation ( source)
- var_export: documentation ( source)
- array_values: documentation ( source)
<?php
$array1 = [
['detail_image_id' => '6389', 'product_name' => 'Starter broadband Package'],
['detail_image_id' => '6358', 'product_name' => 'Starter broadband Package']
];
$array2 = [
['detail_image_id' => '6358', 'guid' => 'http://xxx/wp-content/uploads/2018/04/broadband-4mbs-wingle.jpg'],
['detail_image_id' => '6389', 'guid' => 'http://xxx/wp-content/uploads/2018/04/broadband-4mbs-charji.jpg']
];
$result = [];
foreach (array_merge($array1, $array2) as $row) {
$result[$row['detail_image_id']] = ($result[$row['detail_image_id']] ?? []) + $row;
}
var_export(array_values($result));