3v4l.org

run code in 500+ PHP versions simultaneously
<?php declare(strict_types=1); error_reporting(E_ALL); interface bar { public function test(): string|null; } class foo implements bar { public function test(): string { echo "return __CLASS__" . PHP_EOL; return __CLASS__; } } class foobar extends foo { public function test(): never { echo "exit 0" . PHP_EOL; exit(0); } } (new foo())->test(); (new foobar())->test();
Output for 8.1.7 - 8.1.34, 8.2.0 - 8.2.36, 8.3.0 - 8.3.37, 8.4.1 - 8.4.28, 8.5.0 - 8.5.12
return __CLASS__ exit 0

preferences:
25.71 ms | 1164 KiB | 6 Q