3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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);
based on dna8Z
Output for 5.6.0 - 7.2.0
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 ) )