3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arrays = [ [0 => 12, 5 => 10, 19 => 48], [0 => 14, 7 => 9, 12 => 11, 19 => 30], // ... more arrays ]; $result = []; foreach (array_replace(...$arrays) as $key => $_) { foreach ($arrays as $arr) { $result[$key][] = $arr[$key] ?? null; } } ksort($result); var_export($result);
Output for git.master_jit, git.master
array ( 0 => array ( 0 => 12, 1 => 14, ), 5 => array ( 0 => 10, 1 => NULL, ), 7 => array ( 0 => NULL, 1 => 9, ), 12 => array ( 0 => NULL, 1 => 11, ), 19 => array ( 0 => 48, 1 => 30, ), )

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:
31.56 ms | 406 KiB | 5 Q