How To Append Two Arrays Even If The Keys Are Same?

Is it possible to append two arrays even if the keys are same?

This is my array

Array
(
[0] => Array
(
[product_id] =>23
[product_name] => Furniture
[inquiry_id] => 1032
[company_id] => 541
[extra_data] => Array
(
[from_name] =>
[from_phone] => *********
[from_email] => *******************
[required_quantity] => 54
[expected_price] => 47.00
[expected_delivery_time] => 5
)

)

[1] => Array
(
[product_id] =>24
[product_name] => pipe
[inquiry_id] => 1033
[company_id] => 328
[extra_data] => Array
(
[from_name] =>
[from_phone] => **********
[from_email] => ******************
[required_quantity] => 56
[expected_price] => 41.00
[expected_delivery_time] => 3
)

)

[2] => Array
(
[product_id] =>25
[product_name] => boiler
[inquiry_id] => 1034
[company_id] => 328
[extra_data] => Array
(
[from_name] =>
[from_phone] => ***********
[from_email] => *******************
[required_quantity] => 56
[expected_price] => 41.00
[expected_delivery_time] => 3
)
)

)

Now what i want is, if the company id of two arrays is same then scnd array should append at end of first.
Just like this

Array
(
[0] => Array
(
[product_id] =>23
[product_name] => Furniture
[inquiry_id] => 1032
[company_id] => 541
[extra_data] => Array
(
[from_name] =>
[from_phone] => *********
[from_email] => *******************
[required_quantity] => 54
[expected_price] => 47.00
[expected_delivery_time] => 5
)

)

[1] => Array
(
[product_id] =>24
[product_name] => pipe
[inquiry_id] => 1033
[company_id] => 328
[extra_data] => Array
(
[from_name] =>
[from_phone] => **********
[from_email] => ******************
[required_quantity] => 56
[expected_price] => 41.00
[expected_delivery_time] => 3
)

[product_id] =>25
[product_name] => boiler
[inquiry_id] => 1034
[company_id] => 328
[extra_data] => Array
(
[from_name] =>
[from_phone] => ***********
[from_email] => *******************
[required_quantity] => 56
[expected_price] => 41.00
[expected_delivery_time] => 3

)
)
)

You can try the following code

foreach ($array2 as $v) {
    array_push($array1, $v);
}

http://php.net/manual/en/language.operators.array.php

The array_merge() function will also append 2 arrays re-indexing the numeric keys.

http://php.net/manual/en/function.array-merge.php

$a1 = array('a', 'b');
$a2 = array('a', 'c')
$result = array_merge($a1, $a2);
// $result contains array(0=>'a', 1=>'b', 2=>'a', 3=>'c');