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 class E extends Exception{ public function getAnswer($question) { $reflectionClass = new ReflectionClass('Question'); $property = $reflectionClass->getProperty('answer'); $property->setAccessible(true); return $property->getValue(new Question($this)); } } $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.60.0110.03980.77
8.3.50.0790.05379.51
8.3.40.0470.01048.18
8.3.30.0390.01648.69
8.3.20.0200.01049.79
8.3.10.0130.01049.56
8.3.00.0140.00750.21
8.2.180.0980.06179.80
8.2.170.0380.02948.16
8.2.160.0510.01749.76
8.2.150.0360.02648.30
8.2.140.0500.01747.76
8.2.130.0290.02249.89
8.2.120.0200.01346.87
8.2.110.0170.01349.75
8.2.100.0370.01747.07
8.2.90.0270.01348.30
8.2.80.0160.01647.28
8.2.70.0180.01546.75
8.2.60.0130.02347.05
8.2.50.0100.02146.86
8.2.40.0100.02147.41
8.2.30.0240.01747.43
8.2.20.0220.01947.19
8.2.10.0070.02147.13
8.2.00.0150.01947.14
8.1.280.0520.04579.51
8.1.270.0420.00651.35
8.1.260.0350.00347.17
8.1.250.0210.02150.12
8.1.240.0090.01351.76
8.1.230.0210.02748.66
8.1.220.0170.01747.18
8.1.210.0200.01346.86
8.1.200.0230.01046.85
8.1.190.0230.01346.91
8.1.180.0100.02346.73
8.1.170.0160.01648.20
8.1.160.0210.01751.32
8.1.150.0140.01847.85
8.1.140.0220.01146.80
8.1.130.0170.01047.15
8.1.120.0230.00746.95
8.1.110.0190.02346.85
8.1.100.0060.02246.88
8.1.90.0160.01946.89
8.1.80.0030.02647.00
8.1.70.0130.01646.94
8.1.60.0260.01346.96
8.1.50.0240.00747.03
8.1.40.0160.01647.00
8.1.30.0130.02046.96
8.1.20.0140.01746.96
8.1.10.0160.04280.60
8.1.00.0230.03680.73
8.0.300.0300.02780.22
8.0.290.0330.02380.04
8.0.280.0230.03381.36
8.0.270.0200.03980.17
8.0.260.0040.05379.70
8.0.250.0440.03479.86
8.0.240.0420.03979.89
8.0.230.0160.04279.96
8.0.220.0200.03479.89
8.0.210.0190.03579.82
8.0.200.0270.04079.94
8.0.190.0230.03979.75
8.0.180.0300.03079.76
8.0.170.0240.03779.88
8.0.160.0230.03679.75
8.0.150.0130.04679.86
8.0.140.0330.02779.94
8.0.130.0810.044137.25
8.0.120.0230.03979.82
8.0.110.0130.04379.86
8.0.100.0170.04179.90
8.0.90.0360.02079.93
8.0.80.0770.06879.81
8.0.70.0240.03479.73
8.0.60.0310.02779.75
8.0.50.0170.04079.67
8.0.30.0650.09180.11
8.0.20.0710.08080.06
8.0.10.0300.03080.03
8.0.00.0650.09779.59
7.4.330.0130.03076.06
7.4.320.0320.02379.36
7.4.300.0300.03079.36
7.4.290.0230.04679.26
7.4.280.0230.03679.04
7.4.270.0230.03379.37
7.4.260.0190.03979.03
7.4.250.0270.03479.07
7.4.240.0220.03579.18
7.4.230.0270.03079.35
7.4.220.0820.10179.27
7.4.210.0320.09479.25
7.4.200.0140.04179.45
7.4.190.0200.04679.34
7.4.160.0760.07679.33
7.4.150.0850.10179.13
7.4.140.0820.09979.38
7.4.130.0650.08779.34
7.4.120.0720.07479.32
7.4.110.0660.08279.20
7.4.100.0910.07579.23
7.4.90.0710.08779.13
7.4.80.0600.10479.42
7.4.70.0660.10679.46
7.4.60.0530.09679.30
7.4.50.0100.03379.30
7.4.40.0300.05779.21
7.4.30.0640.07779.25
7.4.00.0330.05377.57
7.3.330.0470.087136.95
7.3.320.0570.057136.88
7.3.310.0260.03879.18
7.3.300.0140.04579.24
7.3.290.0610.09579.23
7.3.280.0610.11779.25
7.3.270.0720.08379.55
7.3.260.0960.11179.30
7.3.250.0700.08579.25
7.3.240.0610.10079.34
7.3.230.0670.08179.15
7.3.210.0870.08779.32
7.3.200.0680.08279.39
7.3.190.0880.10579.43
7.3.180.0650.08779.23
7.3.170.0880.12279.21
7.3.160.0500.09779.32
7.3.120.0330.05677.79
7.2.330.0600.09680.41
7.2.320.0580.13080.27
7.2.310.0560.10280.32
7.2.300.0560.16480.32
7.2.290.0760.16580.17
7.2.60.2000.04779.25
7.2.00.0810.04481.54
7.1.200.1540.04477.89
7.1.101.1950.04980.30
7.1.70.1060.05078.86
7.1.60.0200.07879.55
7.1.50.0340.08279.38
7.1.00.0130.15084.54
7.0.200.0850.04378.75
7.0.140.0200.13384.43
7.0.60.0170.10083.29
7.0.50.0230.15381.19
7.0.40.0070.13020.37
7.0.30.0400.13320.19
7.0.20.0300.09720.37
7.0.10.0230.08720.18
7.0.00.0030.14020.32
5.6.210.0430.09783.07
5.6.200.0130.09380.71
5.6.190.0230.08782.95
5.6.180.0570.12784.76
5.6.170.0570.10083.05
5.6.160.0230.13782.87
5.6.150.0200.10080.59
5.6.140.0270.12380.70
5.6.130.0300.11780.72
5.6.120.0230.16783.68
5.6.110.0300.15383.73
5.6.100.0170.09383.58
5.6.90.0500.11783.57
5.6.80.0300.07783.10
5.5.350.0400.10082.86
5.5.340.0170.10380.39
5.5.330.0330.13782.75
5.5.320.0400.10782.57
5.5.310.0530.13382.65
5.5.300.0200.08780.25
5.5.290.0300.07780.39
5.5.280.0230.08783.40
5.5.270.0170.11383.10
5.5.260.0330.14383.32
5.5.250.0230.14383.14
5.5.240.0330.09382.62
5.4.450.1070.15381.54
5.4.440.1270.14781.48
5.4.430.0470.15381.59
5.4.420.0700.15381.58
5.4.410.0470.14781.32
5.4.400.3330.00081.03
5.4.390.2430.00080.68
5.4.380.0700.15080.65
5.4.370.0630.14380.95
5.4.360.0800.13780.79
5.4.350.0930.12080.93
5.4.340.0700.14780.79
5.4.320.0250.10274.70
5.4.310.0200.10974.70
5.4.300.0280.10474.71
5.4.290.0230.10574.70
5.4.280.0330.12274.60
5.4.270.0670.20080.81
5.4.260.0470.21080.86
5.4.250.0600.18780.98
5.4.240.0700.22380.85
5.4.230.0730.22781.06
5.4.220.0430.13080.96
5.4.210.0370.20080.97
5.4.200.0500.17080.99
5.4.190.0470.12780.96
5.4.180.0670.16381.07
5.4.170.0430.20081.00
5.4.160.0500.14780.71
5.4.150.0770.16380.68
5.4.140.0370.24078.58
5.4.130.0600.22078.55
5.4.120.0500.14078.53
5.4.110.0430.16078.52
5.4.100.0530.20778.47
5.4.90.0330.20078.46
5.4.80.0530.12378.59
5.4.70.0270.17378.63
5.4.60.0500.12078.66
5.4.50.0370.16078.58
5.4.40.0230.15778.57
5.4.30.0400.16378.65
5.4.20.0270.17778.45
5.4.10.0530.21378.54
5.4.00.0530.17077.93
5.3.290.0220.12976.37
5.3.280.0400.20078.27
5.3.270.0570.24378.02
5.3.260.0470.20077.93
5.3.250.0700.24078.11
5.3.240.0630.20377.93
5.3.230.0470.21378.08
5.3.220.0430.15378.16
5.3.210.0370.18378.17
5.3.200.0430.15778.08
5.3.190.0530.15378.13
5.3.180.0500.16778.08
5.3.170.0470.20778.13
5.3.160.0600.17078.23
5.3.150.0330.18778.20
5.3.140.0630.20078.14
5.3.130.0570.15778.23
5.3.120.0270.17077.87
5.3.110.0300.17778.02
5.3.100.0470.20077.50
5.3.90.0600.16777.43
5.3.80.0400.16777.59
5.3.70.0470.17077.45
5.3.60.0470.17777.41
5.3.50.0670.18777.48
5.3.40.0500.22377.21
5.3.30.0470.15377.34
5.3.20.0570.24777.27
5.3.10.0470.18076.73
5.3.00.0570.23377.18
5.2.170.0000.05311.23
5.2.160.0000.04711.23
5.2.150.0030.06011.24
5.2.140.0270.03011.21
5.2.130.0130.05011.07
5.2.120.0100.03310.94
5.2.110.0070.04311.15
5.2.100.0030.05711.07
5.2.90.0100.05711.33
5.2.80.0070.05311.16
5.2.70.0100.05311.18
5.2.60.0030.06311.06
5.2.50.0100.05311.25
5.2.40.0070.04710.99
5.2.30.0070.04010.98
5.2.20.0070.03710.96
5.2.10.0030.04010.70
5.2.00.0130.04710.64
5.1.60.0070.03310.16
5.1.50.0130.03310.00
5.1.40.0030.0539.91
5.1.30.0070.03310.43
5.1.20.0100.03710.44
5.1.10.0100.03310.17
5.1.00.0070.04710.23
5.0.50.0000.0308.54
5.0.40.0030.0308.41
5.0.30.0000.0608.33
5.0.20.0100.0338.29
5.0.10.0000.0408.38
5.0.00.0170.0378.41
4.4.90.0030.0276.60
4.4.80.0070.0276.60
4.4.70.0000.0336.60
4.4.60.0000.0236.60
4.4.50.0000.0336.60
4.4.40.0030.0306.60
4.4.30.0070.0276.60
4.4.20.0030.0206.60
4.4.10.0030.0236.60
4.4.00.0070.0306.60
4.3.110.0070.0236.60
4.3.100.0000.0306.60
4.3.90.0000.0336.60
4.3.80.0030.0336.60
4.3.70.0000.0236.60
4.3.60.0030.0276.60
4.3.50.0030.0236.60
4.3.40.0000.0336.60
4.3.30.0000.0306.60
4.3.20.0000.0306.60
4.3.10.0030.0276.60
4.3.00.0200.0206.99

preferences:
39.43 ms | 401 KiB | 5 Q