3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function __toString() { return '42'; } public static function fromInt(int $value) { } } var_dump(Foo::fromInt(new Foo));
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Fatal error: Uncaught TypeError: Foo::fromInt(): Argument #1 ($value) must be of type int, Foo given, called in /in/ROpEJ on line 15 and defined in /in/ROpEJ:10 Stack trace: #0 /in/ROpEJ(15): Foo::fromInt(Object(Foo)) #1 {main} thrown in /in/ROpEJ on line 10
Process exited with code 255.
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught TypeError: Argument 1 passed to Foo::fromInt() must be of the type int, object given, called in /in/ROpEJ on line 15 and defined in /in/ROpEJ:10 Stack trace: #0 /in/ROpEJ(15): Foo::fromInt(Object(Foo)) #1 {main} thrown in /in/ROpEJ on line 10
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33
Fatal error: Uncaught TypeError: Argument 1 passed to Foo::fromInt() must be of the type integer, object given, called in /in/ROpEJ on line 15 and defined in /in/ROpEJ:10 Stack trace: #0 /in/ROpEJ(15): Foo::fromInt(Object(Foo)) #1 {main} thrown in /in/ROpEJ on line 10
Process exited with code 255.
Output for 5.6.38
Catchable fatal error: Argument 1 passed to Foo::fromInt() must be an instance of int, instance of Foo given, called in /in/ROpEJ on line 15 and defined in /in/ROpEJ on line 10
Process exited with code 255.

preferences:
156.79 ms | 401 KiB | 218 Q