3v4l.org

run code in 300+ PHP versions simultaneously
<?php $c = new ReflectionClass('Exception'); var_dump($c->getConstants(), $c->getMethods()); var_dump(get_parent_class("Exception"));
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.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
array(0) { } array(11) { [0]=> object(ReflectionMethod)#2 (2) { ["name"]=> string(7) "__clone" ["class"]=> string(9) "Exception" } [1]=> object(ReflectionMethod)#3 (2) { ["name"]=> string(11) "__construct" ["class"]=> string(9) "Exception" } [2]=> object(ReflectionMethod)#4 (2) { ["name"]=> string(8) "__wakeup" ["class"]=> string(9) "Exception" } [3]=> object(ReflectionMethod)#5 (2) { ["name"]=> string(10) "getMessage" ["class"]=> string(9) "Exception" } [4]=> object(ReflectionMethod)#6 (2) { ["name"]=> string(7) "getCode" ["class"]=> string(9) "Exception" } [5]=> object(ReflectionMethod)#7 (2) { ["name"]=> string(7) "getFile" ["class"]=> string(9) "Exception" } [6]=> object(ReflectionMethod)#8 (2) { ["name"]=> string(7) "getLine" ["class"]=> string(9) "Exception" } [7]=> object(ReflectionMethod)#9 (2) { ["name"]=> string(8) "getTrace" ["class"]=> string(9) "Exception" } [8]=> object(ReflectionMethod)#10 (2) { ["name"]=> string(11) "getPrevious" ["class"]=> string(9) "Exception" } [9]=> object(ReflectionMethod)#11 (2) { ["name"]=> string(16) "getTraceAsString" ["class"]=> string(9) "Exception" } [10]=> object(ReflectionMethod)#12 (2) { ["name"]=> string(10) "__toString" ["class"]=> string(9) "Exception" } } bool(false)
Output for 5.4.44 - 5.4.45, 5.5.28 - 5.5.35, 5.6.12 - 5.6.28
array(0) { } array(11) { [0]=> &object(ReflectionMethod)#2 (2) { ["name"]=> string(7) "__clone" ["class"]=> string(9) "Exception" } [1]=> &object(ReflectionMethod)#3 (2) { ["name"]=> string(11) "__construct" ["class"]=> string(9) "Exception" } [2]=> &object(ReflectionMethod)#4 (2) { ["name"]=> string(8) "__wakeup" ["class"]=> string(9) "Exception" } [3]=> &object(ReflectionMethod)#5 (2) { ["name"]=> string(10) "getMessage" ["class"]=> string(9) "Exception" } [4]=> &object(ReflectionMethod)#6 (2) { ["name"]=> string(7) "getCode" ["class"]=> string(9) "Exception" } [5]=> &object(ReflectionMethod)#7 (2) { ["name"]=> string(7) "getFile" ["class"]=> string(9) "Exception" } [6]=> &object(ReflectionMethod)#8 (2) { ["name"]=> string(7) "getLine" ["class"]=> string(9) "Exception" } [7]=> &object(ReflectionMethod)#9 (2) { ["name"]=> string(8) "getTrace" ["class"]=> string(9) "Exception" } [8]=> &object(ReflectionMethod)#10 (2) { ["name"]=> string(11) "getPrevious" ["class"]=> string(9) "Exception" } [9]=> &object(ReflectionMethod)#11 (2) { ["name"]=> string(16) "getTraceAsString" ["class"]=> string(9) "Exception" } [10]=> &object(ReflectionMethod)#12 (2) { ["name"]=> string(10) "__toString" ["class"]=> string(9) "Exception" } } bool(false)
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.43, 5.5.24 - 5.5.27, 5.6.8 - 5.6.11
array(0) { } array(10) { [0]=> &object(ReflectionMethod)#2 (2) { ["name"]=> string(7) "__clone" ["class"]=> string(9) "Exception" } [1]=> &object(ReflectionMethod)#3 (2) { ["name"]=> string(11) "__construct" ["class"]=> string(9) "Exception" } [2]=> &object(ReflectionMethod)#4 (2) { ["name"]=> string(10) "getMessage" ["class"]=> string(9) "Exception" } [3]=> &object(ReflectionMethod)#5 (2) { ["name"]=> string(7) "getCode" ["class"]=> string(9) "Exception" } [4]=> &object(ReflectionMethod)#6 (2) { ["name"]=> string(7) "getFile" ["class"]=> string(9) "Exception" } [5]=> &object(ReflectionMethod)#7 (2) { ["name"]=> string(7) "getLine" ["class"]=> string(9) "Exception" } [6]=> &object(ReflectionMethod)#8 (2) { ["name"]=> string(8) "getTrace" ["class"]=> string(9) "Exception" } [7]=> &object(ReflectionMethod)#9 (2) { ["name"]=> string(11) "getPrevious" ["class"]=> string(9) "Exception" } [8]=> &object(ReflectionMethod)#10 (2) { ["name"]=> string(16) "getTraceAsString" ["class"]=> string(9) "Exception" } [9]=> &object(ReflectionMethod)#11 (2) { ["name"]=> string(10) "__toString" ["class"]=> string(9) "Exception" } } bool(false)
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
array(0) { } array(9) { [0]=> &object(ReflectionMethod)#2 (2) { ["name"]=> string(7) "__clone" ["class"]=> string(9) "Exception" } [1]=> &object(ReflectionMethod)#3 (2) { ["name"]=> string(11) "__construct" ["class"]=> string(9) "Exception" } [2]=> &object(ReflectionMethod)#4 (2) { ["name"]=> string(10) "getMessage" ["class"]=> string(9) "Exception" } [3]=> &object(ReflectionMethod)#5 (2) { ["name"]=> string(7) "getCode" ["class"]=> string(9) "Exception" } [4]=> &object(ReflectionMethod)#6 (2) { ["name"]=> string(7) "getFile" ["class"]=> string(9) "Exception" } [5]=> &object(ReflectionMethod)#7 (2) { ["name"]=> string(7) "getLine" ["class"]=> string(9) "Exception" } [6]=> &object(ReflectionMethod)#8 (2) { ["name"]=> string(8) "getTrace" ["class"]=> string(9) "Exception" } [7]=> &object(ReflectionMethod)#9 (2) { ["name"]=> string(16) "getTraceAsString" ["class"]=> string(9) "Exception" } [8]=> &object(ReflectionMethod)#10 (2) { ["name"]=> string(10) "__toString" ["class"]=> string(9) "Exception" } } bool(false)
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Fatal error: Cannot instantiate non-existent class: reflectionclass in /in/3m92l on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: reflectionclass in /in/3m92l on line 3

preferences:
222.72 ms | 401 KiB | 311 Q