3v4l.org

run code in 500+ PHP versions simultaneously
<?php $headers1 = [ 'content-type' => ['application/foo'], '-1' => ['custom'], ]; $headers2 = [ 'content-type' => ['application/bar'], '-1' => ['override'], ]; var_dump($headers1); var_dump(array_merge($headers1, $headers2));
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.36, 8.3.0 - 8.3.37, 8.4.1 - 8.4.28, 8.5.0 - 8.5.12
array(2) { ["content-type"]=> array(1) { [0]=> string(15) "application/foo" } [-1]=> array(1) { [0]=> string(6) "custom" } } array(3) { ["content-type"]=> array(1) { [0]=> string(15) "application/bar" } [0]=> array(1) { [0]=> string(6) "custom" } [1]=> array(1) { [0]=> string(8) "override" } }

preferences:
44.12 ms | 1165 KiB | 6 Q