3v4l.org

run code in 500+ PHP versions simultaneously
<?php function query1($hello,string ...$args) { var_dump($args); } query1('Hello', 'World', 'And'); query1('Hello', ['World', 'And']);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.31, 8.3.0 - 8.3.31, 8.4.1 - 8.4.22, 8.5.0 - 8.5.7
array(2) { [0]=> string(5) "World" [1]=> string(3) "And" } Fatal error: Uncaught TypeError: query1(): Argument #2 must be of type string, array given, called in /in/WvpMR on line 9 and defined in /in/WvpMR:3 Stack trace: #0 /in/WvpMR(9): query1('Hello', Array) #1 {main} thrown in /in/WvpMR on line 3
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
array(2) { [0]=> string(5) "World" [1]=> string(3) "And" } Fatal error: Uncaught TypeError: Argument 2 passed to query1() must be of the type string, array given, called in /in/WvpMR on line 9 and defined in /in/WvpMR:3 Stack trace: #0 /in/WvpMR(9): query1('Hello', Array) #1 {main} thrown in /in/WvpMR on line 3
Process exited with code 255.
Output for 5.6.0 - 5.6.29
Catchable fatal error: Argument 2 passed to query1() must be an instance of string, string given, called in /in/WvpMR on line 8 and defined in /in/WvpMR on line 3
Process exited with code 255.

preferences:
115.99 ms | 1840 KiB | 4 Q