3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { function __construct() { call_user_func([$this, 'test']); } function test() { echo "foo\n"; } } class Bar extends Foo { function __construct() { call_user_func([$this, 'test']); call_user_func([$this, 'self::test']); call_user_func([$this, 'parent::test']); call_user_func([$this, 'Foo::test']); call_user_func([$this, 'Bar::test']); parent::__construct(); } function test() { echo "bar\n"; } } new Bar;
Output for 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
bar Deprecated: Callables of the form ["Bar", "self::test"] are deprecated in /in/G7kc0 on line 18 bar Deprecated: Callables of the form ["Bar", "parent::test"] are deprecated in /in/G7kc0 on line 19 foo Deprecated: Callables of the form ["Bar", "Foo::test"] are deprecated in /in/G7kc0 on line 20 foo Deprecated: Callables of the form ["Bar", "Bar::test"] are deprecated in /in/G7kc0 on line 21 bar bar
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 bar Deprecated: Callables of the form ["Bar", "self::test"] are deprecated in /in/G7kc0 on line 18 bar Deprecated: Callables of the form ["Bar", "parent::test"] are deprecated in /in/G7kc0 on line 19 foo Deprecated: Callables of the form ["Bar", "Foo::test"] are deprecated in /in/G7kc0 on line 20 foo Deprecated: Callables of the form ["Bar", "Bar::test"] are deprecated in /in/G7kc0 on line 21 bar bar
Output for 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28
bar bar foo foo bar bar

preferences:
177.23 ms | 402 KiB | 172 Q