3v4l.org

run code in 300+ PHP versions simultaneously
<?php class x { function foo() { print "foo"; } function bar() { $x = array(get_class(), "foo"); call_user_func($x); $x(); } } $a = new x; $a->bar(); ?>
Output for 8.3.0 - 8.3.6
Deprecated: Calling get_class() without arguments is deprecated in /in/SrG7M on line 8 foo Fatal error: Uncaught Error: Non-static method x::foo() cannot be called statically in /in/SrG7M:10 Stack trace: #0 /in/SrG7M(14): x->bar() #1 {main} thrown in /in/SrG7M on line 10
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
foo Fatal error: Uncaught Error: Non-static method x::foo() cannot be called statically in /in/SrG7M:10 Stack trace: #0 /in/SrG7M(14): x->bar() #1 {main} thrown in /in/SrG7M on line 10
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.31, 7.4.0 - 7.4.33
foo Deprecated: Non-static method x::foo() should not be called statically in /in/SrG7M on line 10 foo
Output for 7.3.32 - 7.3.33
foofoo
Output for 5.4.2 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28
foo Strict Standards: Non-static method x::foo() should not be called statically in /in/SrG7M on line 10 foo

preferences:
232.49 ms | 402 KiB | 257 Q