3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = ['4', 'x' => 5]; // construct with duplicate keys var_dump(['x' => 4, 'x' => 6]); var_dump([2 => 4, 2.0 => 6]); // spread operator leading to duplicate keys var_dump(['x' => 4, ...$arr]); // destruct with duplicate keys ['x' => $a, 'x' => $b] = ['x' => 10]; var_dump([$a, $b]);
Output for git.master, git.master_jit, rfc.property-hooks
array(1) { ["x"]=> int(6) } array(1) { [2]=> int(6) } array(2) { ["x"]=> int(5) [0]=> string(1) "4" } array(2) { [0]=> int(10) [1]=> int(10) }

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:
44.26 ms | 401 KiB | 8 Q