3v4l.org

run code in 300+ PHP versions simultaneously
<?php function multiArrayCombine() { $transposed = array_map(null, ...func_get_args()); foreach ($transposed as &$set) { $set = array_merge(...array_filter($set)); } return $transposed; } $array1 = [['a' => 'val1'], ['a' => 'val2']]; $array2 = [['b' => 'val3'], ['b' => 'val4']]; $array3 = [['c' => 'val5'], [], ['c' => 'val6']]; var_export(multiArrayCombine($array1, $array2, $array3));
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 'a' => 'val1', 'b' => 'val3', 'c' => 'val5', ), 1 => array ( 'a' => 'val2', 'b' => 'val4', ), 2 => array ( 'c' => 'val6', ), )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
60.13 ms | 401 KiB | 8 Q