3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { function __construct() { var_dump(get_class()); var_dump(get_class(null)); } } new Foo;
Output for 8.3.0 - 8.3.7
Deprecated: Calling get_class() without arguments is deprecated in /in/UEr2i on line 5 string(3) "Foo" Fatal error: Uncaught TypeError: get_class(): Argument #1 ($object) must be of type object, null given in /in/UEr2i:6 Stack trace: #0 /in/UEr2i(10): Foo->__construct() #1 {main} thrown in /in/UEr2i on line 6
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
string(3) "Foo" Fatal error: Uncaught TypeError: get_class(): Argument #1 ($object) must be of type object, null given in /in/UEr2i:6 Stack trace: #0 /in/UEr2i(10): Foo->__construct() #1 {main} thrown in /in/UEr2i on line 6
Process exited with code 255.
Output for 5.3.0, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
string(3) "Foo" Warning: get_class() expects parameter 1 to be object, null given in /in/UEr2i on line 6 bool(false)
Output for 5.3.1 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20
string(3) "Foo" string(3) "Foo"
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
string(3) "Foo" bool(false)
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9

preferences:
186.81 ms | 402 KiB | 313 Q