3v4l.org

run code in 300+ PHP versions simultaneously
<?php function handleError($level, $message, $file = '', $line = 0, $context = []) { throw new ErrorException($message, 0, $level, $file, $line); } set_error_handler('handleError'); class A { public function abc(): bool { return false; } } $r = new ReflectionMethod("A", "abc"); (string)$r->getReturnType() ?: "";
Output for 7.1.25 - 7.1.30, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Output for 7.4.0 - 7.4.33
Fatal error: Uncaught ErrorException: Function ReflectionType::__toString() is deprecated in /in/7UK9C:19 Stack trace: #0 /in/7UK9C(19): handleError(8192, 'Function Reflec...', '/in/7UK9C', 19, Array) #1 {main} thrown in /in/7UK9C on line 19
Process exited with code 255.

preferences:
192.94 ms | 402 KiB | 167 Q