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(); } } $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.0100.00718.43
8.3.50.0100.00721.98
8.3.40.0130.00318.97
8.3.30.0040.01219.01
8.3.20.0070.00320.16
8.3.10.0060.00322.09
8.3.00.0090.00022.36
8.2.180.0090.00916.75
8.2.170.0120.00322.96
8.2.160.0100.00720.43
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0070.01126.16
8.2.120.0100.00019.23
8.2.110.0070.00322.33
8.2.100.0130.00019.63
8.2.90.0060.00319.05
8.2.80.0000.00917.97
8.2.70.0000.00817.50
8.2.60.0060.00317.80
8.2.50.0000.00818.07
8.2.40.0040.00418.09
8.2.30.0040.00417.93
8.2.20.0060.00317.60
8.2.10.0080.00019.60
8.2.00.0030.00519.45
8.1.280.0100.00725.92
8.1.270.0130.00721.99
8.1.260.0090.00026.35
8.1.250.0060.00328.09
8.1.240.0060.00323.70
8.1.230.0040.00818.98
8.1.220.0090.00017.74
8.1.210.0000.00818.77
8.1.200.0030.00617.36
8.1.190.0040.00417.38
8.1.180.0090.00018.10
8.1.170.0030.00518.59
8.1.160.0040.00421.91
8.1.150.0060.00318.67
8.1.140.0040.00417.48
8.1.130.0000.00717.77
8.1.120.0000.00717.46
8.1.110.0050.00317.38
8.1.100.0040.00417.41
8.1.90.0040.00517.52
8.1.80.0050.00217.52
8.1.70.0070.00017.49
8.1.60.0030.00617.66
8.1.50.0030.00517.55
8.1.40.0040.00417.54
8.1.30.0050.00317.57
8.1.20.0000.00817.73
8.1.10.0040.00417.53
8.1.00.0060.00317.46
8.0.300.0000.00818.77
8.0.290.0070.00017.16
8.0.280.0040.00418.34
8.0.270.0080.00017.07
8.0.260.0070.00016.75
8.0.250.0040.00416.98
8.0.240.0030.00616.90
8.0.230.0040.00416.86
8.0.220.0050.00316.83
8.0.210.0000.00716.80
8.0.200.0040.00416.96
8.0.190.0000.00716.96
8.0.180.0000.00716.88
8.0.170.0040.00416.89
8.0.160.0000.00716.93
8.0.150.0050.00216.75
8.0.140.0000.00716.99
8.0.130.0030.00313.46
8.0.120.0040.00416.99
8.0.110.0030.00516.87
8.0.100.0050.00317.00
8.0.90.0000.00716.94
8.0.80.0100.01316.96
8.0.70.0020.00517.01
8.0.60.0000.00716.87
8.0.50.0050.00317.04
8.0.30.0100.01016.99
8.0.20.0160.00917.40
8.0.10.0050.00217.16
8.0.00.0120.00816.97
7.4.330.0050.00015.08
7.4.320.0000.00716.63
7.4.300.0030.00516.66
7.4.290.0070.00016.47
7.4.280.0000.00816.41
7.4.270.0040.00416.52
7.4.260.0040.00416.64
7.4.250.0000.00716.61
7.4.240.0000.00716.59
7.4.230.0050.00216.62
7.4.220.0160.00916.57
7.4.210.0050.01316.61
7.4.200.0050.00316.52
7.4.190.0040.00416.53
7.4.160.0100.00616.58
7.4.150.0040.01617.40
7.4.140.0070.01217.86
7.4.130.0100.00816.65
7.4.120.0140.00716.61
7.4.110.0070.01016.70
7.4.100.0200.00716.65
7.4.90.0090.01216.56
7.4.80.0090.00919.39
7.4.70.0100.00616.30
7.4.60.0050.01216.34
7.4.50.0030.00516.54
7.4.40.0070.01122.77
7.4.30.0070.01016.66
7.4.00.0030.01314.81
7.3.330.0030.00313.21
7.3.320.0050.00013.37
7.3.310.0020.00516.26
7.3.300.0030.00316.42
7.3.290.0170.00316.35
7.3.280.0070.01116.35
7.3.270.0130.00617.40
7.3.260.0070.01016.61
7.3.250.0040.01416.47
7.3.240.0120.00416.56
7.3.230.0090.00616.39
7.3.210.0140.00316.27
7.3.200.0120.01219.39
7.3.190.0090.00916.48
7.3.180.0000.01616.28
7.3.170.0040.01816.48
7.3.160.0120.00916.52
7.3.120.0060.01014.67
7.3.00.0100.00716.82
7.2.330.0060.01016.77
7.2.320.0090.00916.69
7.2.310.0070.01116.75
7.2.300.0060.01316.42
7.2.290.0130.01016.57
7.2.130.0110.00416.81
7.2.120.0120.00316.91
7.2.110.0030.00916.81
7.2.100.0120.00616.98
7.2.90.0030.01416.68
7.2.80.0110.00416.84
7.2.70.0100.00316.87
7.2.60.0140.00417.02
7.2.50.0060.01216.81
7.2.40.0130.00317.04
7.2.30.0130.00617.00
7.2.20.0060.01016.64
7.2.10.0100.01016.58
7.2.00.0080.00618.22
7.1.250.0130.00315.62
7.1.240.0110.00315.61
7.1.230.0070.00715.56
7.1.220.0090.00615.53
7.1.210.0040.01215.68
7.1.200.0140.00015.86
7.1.190.0100.00715.89
7.1.180.0170.00015.82
7.1.170.0100.00715.63
7.1.160.0080.00815.50
7.1.150.0120.00915.80
7.1.140.0130.00315.76
7.1.130.0120.00315.55
7.1.120.0070.01115.63
7.1.110.0130.00315.71
7.1.100.0080.00917.01
7.1.90.0100.00715.86
7.1.80.0100.00715.77
7.1.70.0070.00416.32
7.1.60.0050.01517.86
7.1.50.0060.00816.43
7.1.40.0120.00315.56
7.1.30.0090.00315.90
7.1.20.0030.01315.73
7.1.10.0110.00815.63
7.1.00.0070.04219.12
7.0.330.0100.00715.11
7.0.320.0060.00615.31
7.0.310.0030.01315.47
7.0.300.0080.00815.55
7.0.290.0120.00615.15
7.0.280.0150.00015.35
7.0.270.0090.00615.44
7.0.260.0100.00615.24
7.0.250.0110.00415.38
7.0.240.0060.01215.44
7.0.230.0130.00615.58
7.0.220.0030.01015.50
7.0.210.0040.00715.14
7.0.200.0990.00515.89
7.0.190.0040.01115.29
7.0.180.0100.00715.61
7.0.170.0070.00715.07
7.0.160.0160.00315.38
7.0.150.0110.00715.44
7.0.140.0140.03418.72
7.0.130.0100.00715.59
7.0.120.0130.00615.22
7.0.110.0080.00815.60
7.0.100.0230.04417.67
7.0.90.0120.04217.54
7.0.80.0060.04817.72
7.0.70.0110.04417.81
7.0.60.0080.03817.66
7.0.50.0050.04817.78
7.0.40.0020.04916.77
7.0.30.0070.04316.70
7.0.20.0080.04516.79
7.0.10.0080.04316.78
7.0.00.0060.04316.62
5.6.380.0040.01114.57
5.6.370.0080.00814.39
5.6.360.0130.00414.50
5.6.350.0130.00614.58
5.6.340.0120.00814.10
5.6.330.0100.01014.10
5.6.320.0000.02114.57
5.6.310.0040.01114.62
5.6.300.0100.00713.80
5.6.290.0100.01014.13
5.6.280.0060.04117.40
5.6.270.0100.01014.21
5.6.260.0110.00713.97
5.6.250.0130.04217.52
5.6.240.0120.04317.46
5.6.230.0130.04117.35
5.6.220.0070.04117.43
5.6.210.0090.04617.35
5.6.200.0020.05017.63
5.6.190.0090.04717.74
5.6.180.0070.04617.54
5.6.170.0110.04417.46
5.6.160.0140.04117.73
5.6.150.0130.04517.73
5.6.140.0170.04017.58
5.6.130.0090.04717.63
5.6.120.0140.04317.54
5.6.110.0140.03217.62
5.6.100.0030.03917.62
5.6.90.0060.04617.69
5.6.80.0180.03517.33
5.6.70.0110.04717.27
5.6.60.0060.03417.34
5.6.50.0100.04317.22
5.6.40.0130.02417.33
5.6.30.0130.04617.30
5.6.20.0120.04517.27
5.6.10.0100.04417.38
5.6.00.0100.03917.31
5.5.380.0100.04416.01
5.5.370.0150.02516.08
5.5.360.0050.04215.99
5.5.350.0180.03615.98
5.5.340.0120.03716.26
5.5.330.0060.04616.20
5.5.320.0090.04216.20
5.5.310.0070.04616.21
5.5.300.0070.03816.27
5.5.290.0120.03916.19
5.5.280.0070.04216.26
5.5.270.0090.03416.23
5.5.260.0110.04316.26
5.5.250.0070.04716.17
5.5.240.0150.03615.86
5.5.230.0130.02215.86
5.5.220.0130.03615.94
5.5.210.0130.03915.90
5.5.200.0080.04415.88
5.5.190.0110.04015.91
5.5.180.0130.04015.93
5.5.170.0170.00011.60
5.5.160.0140.03815.94
5.5.150.0120.03615.90
5.5.140.0100.04115.88
5.5.130.0070.02715.90
5.5.120.0130.03615.85
5.5.110.0040.02615.93
5.5.100.0040.04115.87
5.5.90.0130.02615.87
5.5.80.0110.04115.86
5.5.70.0120.04115.81
5.5.60.0150.03515.84
5.5.50.0150.03515.88
5.5.40.0080.03415.83
5.5.30.0130.03215.85
5.5.20.0100.03815.84
5.5.10.0070.05115.78
5.5.00.0120.03615.87
5.4.450.0060.04115.56
5.4.440.0050.04215.44
5.4.430.0180.03315.57
5.4.420.0030.03115.53
5.4.410.0110.02215.47
5.4.400.0120.03815.33
5.4.390.0110.03815.33
5.4.380.0060.04315.28
5.4.370.0090.02215.32
5.4.360.0140.03615.35
5.4.350.0110.04015.24
5.4.340.0140.03615.32
5.4.330.0130.00511.60
5.4.320.0090.03815.37
5.4.310.0040.04315.37
5.4.300.0000.04415.24
5.4.290.0050.04215.38
5.4.280.0080.03815.36
5.4.270.0050.02315.22
5.4.260.0030.04215.32
5.4.250.0050.03215.35
5.4.240.0080.03815.32
5.4.230.0020.04615.34
5.4.220.0110.04015.32
5.4.210.0130.03715.31
5.4.200.0080.04015.37
5.4.190.0020.04215.27
5.4.180.0100.03315.30
5.4.170.0090.04215.41
5.4.160.0070.04215.34
5.4.150.0030.03715.38
5.4.140.0040.04114.04
5.4.130.0070.03914.04
5.4.120.0020.04414.04
5.4.110.0110.03314.03
5.4.100.0050.04114.10
5.4.90.0150.03014.03
5.4.80.0130.03313.96
5.4.70.0100.02214.07
5.4.60.0050.03513.96
5.4.50.0080.03813.95
5.4.40.0090.04214.05
5.4.30.0030.04113.96
5.4.20.0070.04013.98
5.4.10.0130.02213.98
5.4.00.0050.03813.73
5.3.290.0040.04613.17
5.3.280.0080.02613.12
5.3.270.0060.04213.10
5.3.260.0050.04313.16
5.3.250.0100.03713.16
5.3.240.0050.03113.15
5.3.230.0080.02313.12
5.3.220.0070.04113.08
5.3.210.0080.04013.10
5.3.200.0080.03613.15
5.3.190.0050.04113.12
5.3.180.0040.04313.08
5.3.170.0070.03813.05
5.3.160.0070.02213.05
5.3.150.0050.03913.08
5.3.140.0120.03713.15
5.3.130.0130.03713.14
5.3.120.0080.03813.15
5.3.110.0080.03513.11
5.3.100.0070.02512.79
5.3.90.0100.03512.82
5.3.80.0120.03212.76
5.3.70.0100.04112.78
5.3.60.0120.03812.86
5.3.50.0130.03412.85
5.3.40.0090.03512.83
5.3.30.0050.03912.78
5.3.20.0070.04012.68
5.3.10.0090.03612.62
5.3.00.0120.03412.65
5.2.170.0080.02111.37
5.2.160.0080.03511.31
5.2.150.0120.03011.34
5.2.140.0050.03411.42
5.2.130.0040.02211.30
5.2.120.0080.02811.40
5.2.110.0060.03611.30
5.2.100.0100.02911.37
5.2.90.0100.02811.39
5.2.80.0120.02011.35
5.2.70.0080.03011.38
5.2.60.0090.03211.38
5.2.50.0100.03011.31
5.2.40.0090.02411.26
5.2.30.0070.03011.35
5.2.20.0100.02911.31
5.2.10.0070.03011.28
5.2.00.0050.03111.23
5.1.60.0040.02210.85
5.1.50.0040.03010.72
5.1.40.0080.02310.71
5.1.30.0100.02211.01
5.1.20.0130.02510.89
5.1.10.0110.02010.88
5.1.00.0050.02810.87
5.0.50.0020.02110.11
5.0.40.0050.0239.96
5.0.30.0030.0369.93
5.0.20.0090.0209.93
5.0.10.0050.0269.93
5.0.00.0000.0349.93
4.4.90.0030.0209.93
4.4.80.0030.0169.93
4.4.70.0070.0109.93
4.4.60.0020.0219.93
4.4.50.0050.0169.93
4.4.40.0030.0279.93
4.4.30.0030.0159.93
4.4.20.0060.0109.93
4.4.10.0050.0209.93
4.4.00.0030.0279.93
4.3.110.0040.0219.93
4.3.100.0080.0159.93
4.3.90.0070.0189.93
4.3.80.0020.0309.93
4.3.70.0030.0189.93
4.3.60.0040.0179.93
4.3.50.0020.0209.93
4.3.40.0040.0269.93
4.3.30.0020.0189.93
4.3.20.0030.0219.93
4.3.10.0000.0219.93
4.3.00.0030.0199.93

preferences:
48.67 ms | 401 KiB | 5 Q