3v4l.org

run code in 300+ PHP versions simultaneously
<?php $orders = array ( 0 => array ( 'order_id' => 45145, 'customers_email_address' => 'test@test.com', 'customers_name' => 'testname' ), 1 => array ( 'order_id' => 45136, 'customers_email_address' => 'test@yahoo.com', 'customers_name' => 'testname' ), 2 => array ( 'order_id' => 45117, 'customers_email_address' => 'test@yahoo.com', 'customers_name' => 'testname' ), 3 => array ( 'order_id' => 44959, 'customers_email_address' => 'test@gmail.com', 'customers_name' => 'testname' ), 4 => array ( 'order_id' => 44938, 'customers_email_address' => 'test@hotmail.com', 'customers_name' => 't' ) ); $chitchattracking = array ( 1 => array ( 'order_id' => 44938, 'carrier_tracking_code' => 9205590221582717655498 ), 2 => array ( 'order_id' => 44854, 'carrier_tracking_code' => 92055902215827 ) ); $tracking = array(); $chitchat = array_column($chitchattracking, null, 'order_id'); foreach ($orders as $order) { $order_id = $order['order_id']; if (isset($chitchat[$order_id])) { $tracking[] = array_merge($order, $chitchat[$order_id]); } } print_r($tracking);

preferences:
202.63 ms | 407 KiB | 5 Q