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); } 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]

preferences:
49.93 ms | 402 KiB | 5 Q