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.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
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.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 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:
220.64 ms | 401 KiB | 288 Q