3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr_orderno = [12321,321,321]; $arr_deliverysn = [7,8,9]; $arr_deliverycorpname = ['asd','qwe','zxc']; $arr_merge = []; for($i = 0; $i < count($arr_orderno); $i++){ $arr_merge[$i] = [$arr_orderno[$i], $arr_deliverysn[$i], $arr_deliverycorpname[$i]]; } $arr_key = ['orderno', 'deliverysn', 'deliverycorpname']; $arr = []; foreach ($arr_merge as $value) { $arr[] = array_combine($arr_key, $value); } print_r($arr);
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.26, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
Array ( [0] => Array ( [orderno] => 12321 [deliverysn] => 7 [deliverycorpname] => asd ) [1] => Array ( [orderno] => 321 [deliverysn] => 8 [deliverycorpname] => qwe ) [2] => Array ( [orderno] => 321 [deliverysn] => 9 [deliverycorpname] => zxc ) )

preferences:
68.43 ms | 409 KiB | 5 Q