3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $x = [0, 1, 2, 3]; unset($x[0]); // There's no index 0. function foo(...$arg) { var_dump($arg); } 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]
based on FU5Ia
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.3.0rc3
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) }