3v4l.org

run code in 300+ PHP versions simultaneously
<?php set_error_handler(function() { throw new Exception(); }); class A { public function method($test = UNKNOWN_CONSTANT) { } } $class = new ReflectionClass('A'); echo $class;
Output for 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Class [ <user> class A ] { @@ /in/ekEkd 7-12 - Constants [0] { } - Static properties [0] { } - Static methods [0] { } - Properties [0] { } - Methods [1] { Method [ <user> public method method ] { @@ /in/ekEkd 9 - 11 - Parameters [1] { Parameter #0 [ <optional> $test = UNKNOWN_CONSTANT ] } } } }
Output for 8.0.0 - 8.0.30
Fatal error: Uncaught Error: Undefined constant "UNKNOWN_CONSTANT" in /in/ekEkd:16 Stack trace: #0 /in/ekEkd(16): ReflectionClass->__toString() #1 {main} thrown in /in/ekEkd on line 16
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Fatal error: Uncaught Exception in /in/ekEkd:4 Stack trace: #0 [internal function]: {closure}(2, 'Use of undefine...', '/in/ekEkd', 16, Array) #1 /in/ekEkd(16): ReflectionClass->__toString() #2 {main} thrown in /in/ekEkd on line 4
Process exited with code 255.
Output for 7.0.1 - 7.0.11, 7.0.21 - 7.0.33, 7.1.7 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33
Fatal error: Method ReflectionClass::__toString() must not throw an exception, caught Exception: in /in/ekEkd on line 0
Process exited with code 255.
Output for 7.0.12 - 7.0.20, 7.1.0 - 7.1.6

Process exited with code 139.
Output for 5.6.0 - 5.6.40, 7.0.0
Fatal error: Method ReflectionClass::__toString() must not throw an exception in /in/ekEkd on line 0
Process exited with code 255.

preferences:
195.41 ms | 401 KiB | 284 Q