3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo($a, $b) { echo "$a $b\n";} foo(...['x', 'y']); // x y // named parameters foo(...['a' => 'x', 'b' => 'y']); // x y foo(...['b' => 'x', 'a' => 'y']); // y x // positional parameters: integer key not used foo(...[0 => 'x', 1 => 'y']); // x y foo(...[120 => 'x', 11 => 'y']); // x y foo(...[11 => 'y', 120 => 'x']); // y x ?>
Output for 8.1.32 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
x y x y y x x y x y y x

preferences:
58.39 ms | 851 KiB | 5 Q