3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = '[{ "product_name": "Product1", "qty": "1" }, { "product_name": "Product2", "qty": "2" }, { "product_name": "Product3", "qty": "3" }]'; $array2 = '[{ "product_name": "Product4", "qty": "1" }, { "product_name": "Product3", "qty": "1" }, { "product_name": "Product2", "qty": "1" }]'; $arr1 = json_decode($array1, true); $arr2 = json_decode($array2, true); $result = array_merge($arr1,$arr2); var_export($result);

preferences:
59.99 ms | 402 KiB | 5 Q