3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = [0, 1, 2, 3]; unset($x[0]); // There's no index 0. function foo(...$arg) { var_dump($arg); } var_dump(...$x); foo($x); // Yet no errors or nothing: [0 => 1, 1 => 2, 2 => 3] $y = [0, 1]; $y[3] = 3; // Adding elements out of order. $y[2] = 2; var_dump($y); // Out of order: [0 => 0, 1 => 1, 3 => 3, 2 => 2] foo(...$y); // Uses the order, not the indexes: [0 => 0, 1 => 1, 2 => 3, 3 => 2]
Output for git.master, git.master_jit, rfc.property-hooks
int(1) int(2) int(3) array(1) { [0]=> array(3) { [1]=> int(1) [2]=> int(2) [3]=> int(3) } } array(4) { [0]=> int(0) [1]=> int(1) [3]=> int(3) [2]=> int(2) } array(4) { [0]=> int(0) [1]=> int(1) [2]=> int(3) [3]=> int(2) }

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