3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { const FOO = 'hi'; public static function foo() { echo self::FOO; } } Foo::foo();
Output for 8.1.23 - 8.1.27, 8.2.10 - 8.2.17, 8.3.0 - 8.3.4
hi
Output for 7.0.0 - 7.0.1
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Foo has a deprecated constructor in /in/RYdUt on line 3 Fatal error: Constructor Foo::foo() cannot be static in /in/RYdUt on line 3
Process exited with code 255.
Output for 5.5.24 - 5.5.30, 5.6.8 - 5.6.16
Fatal error: Constructor Foo::foo() cannot be static in /in/RYdUt on line 11
Process exited with code 255.

preferences:
70.72 ms | 401 KiB | 41 Q