3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = [2 => [0 => 41000, 1 => 31079], 3 => [0 => 42963, 1 => 41189]]; $arr2 = [2 => [0 => 40213, 1 => 42054], 3 => [0 => 42998, 1 => 34567]]; function addArray(&$bucket, $water) { foreach ($water as $key => $drop) { $bucket[$key] = array_merge($bucket[$key] ?? [], $drop); } } $combined = []; addArray($combined, $arr1); addArray($combined, $arr2); var_export($combined);
Output for git.master_jit, git.master, rfc.property-hooks
array ( 2 => array ( 0 => 41000, 1 => 31079, 2 => 40213, 3 => 42054, ), 3 => array ( 0 => 42963, 1 => 41189, 2 => 42998, 3 => 34567, ), )

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:
123.63 ms | 405 KiB | 5 Q