3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Challenge 3: Use reflection to get access to Question::$answer from $e->getAnswer */ class Question { private $answer = 42; public function __construct($e) { try { throw $e; } catch (Exception $e) { echo $e->getAnswer($this) . PHP_EOL; } } } // start editing here $question = new Question('test'); class E extends Exception{ public function getAnswer($question) { $reflectionClass = new ReflectionClass('Question'); $property = $reflectionClass->getProperty('answer'); $property->setAccessible(true); return $property->getValue(); } } $e = new E; // end editing here new Question($e);

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.70.0040.01118.28
8.3.60.0060.00918.56
8.3.50.0080.01521.99
8.3.40.0070.01018.80
8.3.30.0100.00719.08
8.3.20.0050.00220.39
8.3.10.0040.00421.96
8.3.00.0040.00422.23
8.2.190.0110.00716.58
8.2.180.0030.01716.50
8.2.170.0040.01122.96
8.2.160.0100.00320.55
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0000.00726.16
8.2.120.0080.00019.48
8.2.110.0100.00022.31
8.2.100.0070.00419.64
8.2.90.0070.00019.09
8.2.80.0000.00818.04
8.2.70.0110.00017.63
8.2.60.0040.00418.04
8.2.50.0030.00618.07
8.2.40.0060.00318.21
8.2.30.0000.00717.88
8.2.20.0070.00017.65
8.2.10.0000.00819.52
8.2.00.0040.00417.74
8.1.280.0130.00325.92
8.1.270.0000.00822.14
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0080.00023.84
8.1.230.0070.00419.04
8.1.220.0030.00517.76
8.1.210.0050.00318.77
8.1.200.0030.00617.22
8.1.190.0080.00017.53
8.1.180.0000.00818.10
8.1.170.0060.00318.55
8.1.160.0060.00322.01
8.1.150.0040.00418.65
8.1.140.0000.00717.46
8.1.130.0040.00417.79
8.1.120.0070.00017.52
8.1.110.0030.00317.36
8.1.100.0030.00317.46
8.1.90.0100.00017.43
8.1.80.0080.00017.29
8.1.70.0070.00017.30
8.1.60.0040.00417.50
8.1.50.0000.00717.43
8.1.40.0000.00717.39
8.1.30.0000.00817.60
8.1.20.0040.00417.68
8.1.10.0000.00817.57
8.1.00.0000.00817.50
8.0.300.0000.00818.77
8.0.290.0040.00417.05
8.0.280.0030.00318.35
8.0.270.0000.00717.07
8.0.260.0040.00416.70
8.0.250.0070.00017.02
8.0.240.0050.00316.98
8.0.230.0030.00316.85
8.0.220.0000.00716.92
8.0.210.0070.00016.90
8.0.200.0040.00416.85
8.0.190.0040.00416.88
8.0.180.0030.00316.92
8.0.170.0020.00516.86
8.0.160.0000.00716.89
8.0.150.0000.00716.81
8.0.140.0000.00716.91
8.0.130.0000.00513.39
8.0.120.0030.00516.95
8.0.110.0000.00717.01
8.0.100.0050.00316.96
8.0.90.0040.00416.84
8.0.80.0000.01616.90
8.0.70.0070.00016.98
8.0.60.0000.00716.89
8.0.50.0000.00816.91
8.0.30.0110.00817.15
8.0.20.0130.00517.40
8.0.10.0050.00217.08
8.0.00.0070.01216.62
7.4.330.0000.00515.09
7.4.320.0000.00616.61
7.4.300.0000.00716.59
7.4.290.0030.00316.52
7.4.280.0000.00716.52
7.4.270.0070.00016.58
7.4.260.0070.00016.45
7.4.250.0040.00416.39
7.4.240.0050.00216.54
7.4.230.0030.00316.35
7.4.220.0140.01016.52
7.4.210.0090.00516.48
7.4.200.0000.00816.35
7.4.190.0050.00216.46
7.4.160.0030.01316.70
7.4.150.0090.00917.40
7.4.140.0080.01317.86
7.4.130.0150.00316.66
7.4.120.0150.00316.66
7.4.110.0060.01216.52
7.4.100.0080.01116.41
7.4.90.0100.00716.46
7.4.80.0140.01019.39
7.4.70.0080.00816.45
7.4.60.0040.01216.50
7.4.50.0000.00516.50
7.4.40.0000.01422.77
7.4.30.0090.01216.72
7.4.00.0100.00614.99
7.3.330.0030.00313.20
7.3.320.0050.00013.24
7.3.310.0000.00716.38
7.3.300.0040.00416.23
7.3.290.0060.00916.36
7.3.280.0090.01016.37
7.3.270.0160.00317.40
7.3.260.0110.00716.66
7.3.250.0070.00916.47
7.3.240.0170.00016.40
7.3.230.0130.00316.44
7.3.210.0090.00916.62
7.3.200.0090.00919.39
7.3.190.0080.00916.30
7.3.180.0060.01016.61
7.3.170.0140.00716.39
7.3.160.0180.00016.51
7.3.120.0050.01214.91
7.3.110.0070.00715.00
7.3.100.0000.01714.98
7.3.90.0070.00714.86
7.3.80.0090.00914.75
7.3.70.0130.00314.56
7.3.60.0060.00914.93
7.3.50.0090.00614.81
7.3.40.0100.00714.61
7.3.30.0130.00014.54
7.3.20.0090.00616.86
7.3.10.0040.01116.65
7.3.00.0040.00416.47
7.2.330.0120.00916.52
7.2.320.0070.01816.32
7.2.310.0120.00616.59
7.2.300.0080.00816.32
7.2.290.0090.01216.40
7.2.250.0070.01115.18
7.2.240.0060.01314.74
7.2.230.0040.01215.09
7.2.220.0040.01515.03
7.2.210.0070.01114.84
7.2.200.0060.00614.97
7.2.190.0080.00814.81
7.2.180.0120.00314.98
7.2.170.0100.00714.84
7.2.60.0060.00616.87
7.2.00.0000.01419.25
7.1.330.0070.00715.99
7.1.320.0030.00715.43
7.1.310.0070.00715.77
7.1.300.0000.01515.38
7.1.290.0060.00615.78
7.1.280.0030.01315.54
7.1.270.0040.01115.73
7.1.260.0040.01115.73
7.1.200.0000.01015.81
7.1.100.0030.01017.85
7.1.70.0080.00317.07
7.1.60.0100.01419.82
7.1.50.0230.01334.61
7.1.00.0030.07722.31
7.0.200.0110.00716.73
7.0.140.0070.07021.95
7.0.110.0430.04019.99
7.0.100.0530.08320.05
7.0.90.0500.05319.85
7.0.80.0670.06020.04
7.0.70.0600.07019.89
7.0.60.0670.07319.66
7.0.50.0600.08019.81
7.0.40.0100.07719.71
7.0.30.0030.04719.82
7.0.20.0000.08719.71
7.0.10.0030.08719.78
7.0.00.0030.05019.64
5.6.280.0070.07021.05
5.6.260.0030.07020.71
5.6.250.0000.04320.69
5.6.240.0070.04020.87
5.6.230.0000.08720.73
5.6.220.0070.08020.66
5.6.210.0070.07720.63
5.6.200.0200.06720.63
5.6.190.0030.09320.63
5.6.180.0070.08320.65
5.6.170.0070.04020.57
5.6.160.0030.04720.63
5.6.150.0170.07020.67
5.6.140.0070.07020.66
5.6.130.0070.07320.64
5.6.120.0100.08020.47
5.6.110.0030.08320.68
5.6.100.0070.08720.61
5.6.90.0070.07020.54
5.6.80.0070.08020.02
5.6.70.0100.07720.04
5.6.60.0100.08020.06
5.6.50.0030.09019.95
5.6.40.0030.07720.07
5.6.30.0030.08019.83
5.6.20.0070.04719.98
5.6.10.0070.08019.95
5.6.00.0100.07019.93
5.5.380.0200.07017.68
5.5.370.0030.08317.53
5.5.360.0030.08017.71
5.5.350.0130.06317.66
5.5.340.0170.07718.10
5.5.330.0130.07718.07
5.5.320.0000.08317.92
5.5.310.0130.08017.91
5.5.300.0000.08318.13
5.5.290.0000.08718.10
5.5.280.0130.07318.05
5.5.270.0030.06318.08
5.5.260.0070.06018.09
5.5.250.0100.05017.91
5.5.240.0070.08017.45
5.5.230.0100.07317.34
5.5.220.0070.08017.60
5.5.210.0030.08017.63
5.5.200.0070.07017.49
5.5.190.0030.05317.45
5.5.180.0070.08017.27
5.5.160.0100.07317.23
5.5.150.0070.07317.42
5.5.140.0070.07717.48
5.5.130.0070.07317.47
5.5.120.0070.07717.41
5.5.110.0170.07017.44
5.5.100.0170.04317.48
5.5.90.0130.05717.48
5.5.80.0130.06717.16
5.5.70.0000.08017.07
5.5.60.0100.07317.46
5.5.50.0000.07017.38
5.5.40.0170.04717.15
5.5.30.0200.06317.49
5.5.20.0030.07017.11
5.5.10.0100.07017.19
5.5.00.0000.05017.16
5.4.450.0030.04719.33
5.4.440.0070.08319.31
5.4.430.0070.08319.63
5.4.420.0130.07319.32
5.4.410.0100.07019.21
5.4.400.0070.04718.99
5.4.390.0030.08019.34
5.4.380.0030.07019.24
5.4.370.0100.06019.09
5.4.360.0070.06719.23
5.4.350.0070.05719.19
5.4.340.0000.08319.00
5.4.320.0000.05719.16
5.4.310.0070.07719.24
5.4.300.0070.08018.99
5.4.290.0070.07319.18
5.4.280.0070.08318.95
5.4.270.0130.03319.00
5.4.260.0070.07719.14
5.4.250.0100.07319.22
5.4.240.0070.05319.08
5.4.230.0030.08019.24
5.4.220.0030.07719.00
5.4.210.0070.07319.34
5.4.200.0070.07019.33
5.4.190.0000.08018.97
5.4.180.0100.03719.13
5.4.170.0070.07018.97
5.4.160.0130.07018.96
5.4.150.0100.07718.95
5.4.140.0000.04716.48
5.4.130.0070.07716.38
5.4.120.0000.07716.38
5.4.110.0000.06716.62
5.4.100.0070.07016.70
5.4.90.0030.08016.55
5.4.80.0130.06716.50
5.4.70.0070.04716.35
5.4.60.0030.04016.50
5.4.50.0130.06016.33
5.4.40.0070.07716.57
5.4.30.0070.07716.66
5.4.20.0070.07316.28
5.4.10.0170.06316.43
5.4.00.0070.06715.96
5.3.290.0100.06714.67
5.3.280.0130.04714.46
5.3.270.0070.07714.70
5.3.260.0070.07714.65
5.3.250.0130.04714.62
5.3.240.0200.06014.64
5.3.230.0100.06314.69
5.3.220.0070.07014.57
5.3.210.0100.06714.55
5.3.200.0070.04714.70
5.3.190.0130.07314.57
5.3.180.0130.06714.60
5.3.170.0130.06314.60
5.3.160.0030.07314.56
5.3.150.0030.08014.57
5.3.140.0170.07014.58
5.3.130.0100.07014.55
5.3.120.0070.07314.64
5.3.110.0100.07314.70
5.3.100.0070.03714.17
5.3.90.0100.06014.06
5.3.80.0100.07014.03
5.3.70.0070.07714.04
5.3.60.0200.05014.15
5.3.50.0000.04314.06
5.3.40.0030.04714.05
5.3.30.0070.03313.92
5.3.20.0070.03713.65
5.3.10.0030.03713.89
5.3.00.0000.04313.50
5.2.170.0070.05311.14
5.2.160.0070.06011.17
5.2.150.0000.03711.12
5.2.140.0030.04011.19
5.2.130.0070.04310.96
5.2.120.0000.03711.20
5.2.110.0130.02011.11
5.2.100.0000.03011.18
5.2.90.0000.03310.97
5.2.80.0000.03011.18
5.2.70.0030.02711.12
5.2.60.0000.03011.14
5.2.50.0000.03311.25
5.2.40.0000.03311.02
5.2.30.0070.04011.07
5.2.20.0070.06011.05
5.2.10.0100.04010.88
5.2.00.0030.05010.72
5.1.60.0100.0379.98
5.1.50.0030.04010.06
5.1.40.0000.03710.23
5.1.30.0030.03310.30
5.1.20.0000.03010.38
5.1.10.0070.02010.15
5.1.00.0000.02310.33
5.0.50.0030.0279.95
5.0.40.0000.0209.95
5.0.30.0000.0309.95
5.0.20.0030.0209.95
5.0.10.0030.0179.95
5.0.00.0030.0509.95
4.4.90.0030.0139.95
4.4.80.0070.0309.95
4.4.70.0070.0239.95
4.4.60.0000.0309.95
4.4.50.0070.0309.95
4.4.40.0000.0339.95
4.4.30.0000.0139.95
4.4.20.0000.0179.95
4.4.10.0000.0179.95
4.4.00.0000.0409.95
4.3.110.0030.0139.95
4.3.100.0030.0239.95
4.3.90.0000.0139.95
4.3.80.0030.0279.95
4.3.70.0000.0139.95
4.3.60.0030.0109.95
4.3.50.0030.0179.95
4.3.40.0000.0309.95
4.3.30.0000.0139.95
4.3.20.0000.0179.95
4.3.10.0000.0139.95
4.3.00.0000.0139.95

preferences:
40.5 ms | 401 KiB | 5 Q