3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo($x, ...$array) { print_r($x); print_r($array); } $a = ['w' => 'w', 'x' => 'x']; foo(...$a); print_r(array_merge(...$a)); // array_merge() does not accept unknown named parameters
Output for 8.1.34, 8.2.29 - 8.2.30, 8.3.5 - 8.3.30, 8.4.7 - 8.4.18, 8.5.0 - 8.5.3
xArray ( [w] => w ) Fatal error: Uncaught ArgumentCountError: array_merge() does not accept unknown named parameters in /in/miPmk:12 Stack trace: #0 /in/miPmk(12): array_merge(w: 'w', x: 'x') #1 {main} thrown in /in/miPmk on line 12
Process exited with code 255.

preferences:
52.71 ms | 627 KiB | 4 Q