3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array('foo' => "xyz", null => "abc"); $b = array('bar' => "baz", null => "xyz"); var_dump(array_merge_recursive($a,$b)); var_dump(merge($a,$b)); function merge(array $a, array $b) { foreach ($b as $key => $value) { if (isset($a[$key])) { if (is_int($key)) { $a[] = $value; } elseif (is_array($value) && is_array($a[$key])) { $a[$key] = merge($a[$key], $value); } else { $a[$key] = $value; } } else { $a[$key] = $value; } } return $a; }
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { ["foo"]=> string(3) "xyz" [""]=> array(2) { [0]=> string(3) "abc" [1]=> string(3) "xyz" } ["bar"]=> string(3) "baz" } array(3) { ["foo"]=> string(3) "xyz" [""]=> string(3) "xyz" ["bar"]=> string(3) "baz" }

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:
43.62 ms | 402 KiB | 8 Q