3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo(Traversable $trav) { } foo([1,2,3]);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.13
Fatal error: Uncaught TypeError: foo(): Argument #1 ($trav) must be of type Traversable, array given, called in /in/YhUeN on line 7 and defined in /in/YhUeN:3 Stack trace: #0 /in/YhUeN(7): foo(Array) #1 {main} thrown in /in/YhUeN on line 3
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught TypeError: Argument 1 passed to foo() must implement interface Traversable, array given, called in /in/YhUeN on line 7 and defined in /in/YhUeN:3 Stack trace: #0 /in/YhUeN(7): foo(Array) #1 {main} thrown in /in/YhUeN on line 3
Process exited with code 255.

preferences:
145.82 ms | 408 KiB | 5 Q