3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (version_compare(phpversion(), '8.2.0', '<')) { interface Greet { function speak(); } class Hello implements Greet { function speak() { return 'world'; } } } else { interface Greet { function speak(): string; } class Hello implements Greet { function speak(): string { return 'world'; } } } echo (new Hello())->speak();
Output for 5.6.5
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/dZ4OT on line 19
Process exited with code 255.

preferences:
64.06 ms | 405 KiB | 5 Q