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 Answer extends Exception { public function getAnswer($object) { return $object->answer; } } $e = new Answer; // 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.00418.14
8.3.50.0110.01016.39
8.3.40.0110.00318.89
8.3.30.0000.01418.84
8.3.20.0030.00518.77
8.3.10.0030.00520.61
8.3.00.0050.00317.50
8.2.180.0070.00718.66
8.2.170.0090.00922.96
8.2.160.0170.00322.15
8.2.150.0080.00024.18
8.2.140.0030.00624.66
8.2.130.0070.00026.16
8.2.120.0050.00319.64
8.2.110.0060.00321.01
8.2.100.0040.00817.78
8.2.90.0040.00419.17
8.2.80.0040.00418.04
8.2.70.0090.00017.63
8.2.60.0040.00417.80
8.2.50.0090.00018.07
8.2.40.0040.00418.03
8.2.30.0060.00317.92
8.2.20.0000.00817.66
8.2.10.0040.00417.63
8.2.00.0060.00317.86
8.1.280.0080.00825.92
8.1.270.0040.00423.99
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0030.00622.55
8.1.230.0030.00921.04
8.1.220.0040.00418.77
8.1.210.0040.00418.89
8.1.200.0030.00617.25
8.1.190.0000.00717.53
8.1.180.0030.00718.10
8.1.170.0040.00418.89
8.1.160.0060.00318.90
8.1.150.0000.00718.69
8.1.140.0000.00717.53
8.1.130.0000.00717.76
8.1.120.0000.00717.39
8.1.110.0050.00217.37
8.1.100.0000.00717.45
8.1.90.0020.00517.34
8.1.80.0070.00017.46
8.1.70.0070.00017.43
8.1.60.0040.00417.54
8.1.50.0040.00417.47
8.1.40.0040.00417.40
8.1.30.0000.00817.70
8.1.20.0040.00417.70
8.1.10.0000.00817.45
8.1.00.0040.00417.49
8.0.300.0070.00019.95
8.0.290.0070.00016.75
8.0.280.0030.00318.40
8.0.270.0000.00717.12
8.0.260.0060.00016.82
8.0.250.0000.00816.99
8.0.240.0000.00716.98
8.0.230.0000.00816.84
8.0.220.0000.00716.93
8.0.210.0040.00416.93
8.0.200.0000.00617.00
8.0.190.0000.00716.86
8.0.180.0040.00416.91
8.0.170.0030.00516.91
8.0.160.0000.00716.85
8.0.150.0080.00016.73
8.0.140.0000.01016.79
8.0.130.0030.00313.39
8.0.120.0000.00816.82
8.0.110.0040.00416.96
8.0.100.0000.00816.86
8.0.90.0040.00416.86
8.0.80.0080.01216.95
8.0.70.0070.00016.99
8.0.60.0000.00716.85
8.0.50.0040.00416.91
8.0.30.0110.00917.13
8.0.20.0130.00417.18
8.0.10.0000.00816.98
8.0.00.0100.00716.77
7.4.330.0060.00014.66
7.4.320.0060.00016.50
7.4.300.0000.00616.42
7.4.290.0000.00816.44
7.4.280.0030.00616.62
7.4.270.0030.00316.41
7.4.260.0050.00313.32
7.4.250.0090.00016.59
7.4.240.0040.00416.53
7.4.230.0070.00016.61
7.4.220.0130.00616.49
7.4.210.0080.00716.56
7.4.200.0070.00016.36
7.4.190.0000.00716.47
7.4.160.0120.00316.50
7.4.150.0100.01017.18
7.4.140.0030.01317.22
7.4.130.0100.00816.63
7.4.120.0080.01116.63
7.4.110.0030.01416.52
7.4.100.0080.00916.63
7.4.90.0030.01416.58
7.4.80.0140.00318.80
7.4.70.0110.01016.64
7.4.60.0110.01116.56
7.4.50.0040.00416.62
7.4.40.0060.01022.27
7.4.30.0100.00616.72
7.4.00.0120.00314.71
7.3.330.0070.00013.18
7.3.320.0060.00013.29
7.3.310.0030.00316.39
7.3.300.0000.00716.41
7.3.290.0060.00616.32
7.3.280.0040.01216.35
7.3.270.0150.00317.18
7.3.260.0060.01118.24
7.3.250.0110.00816.45
7.3.240.0090.00916.46
7.3.230.0070.01016.39
7.3.210.0100.01316.33
7.3.200.0060.00919.39
7.3.190.0080.01116.52
7.3.180.0090.00616.55
7.3.170.0060.01116.37
7.3.160.0100.00616.43
7.3.120.0120.00414.91
7.3.10.0100.00316.27
7.3.00.0090.00416.54
7.2.330.0140.00516.71
7.2.320.0040.01916.77
7.2.310.0150.00916.72
7.2.300.0080.01116.75
7.2.290.0070.01016.49
7.2.130.0070.00716.52
7.2.120.0030.01016.81
7.2.110.0120.00516.80
7.2.100.0090.00616.94
7.2.90.0090.00916.66
7.2.80.0090.00616.82
7.2.70.0040.01416.90
7.2.60.0070.00516.80
7.2.50.0000.01416.74
7.2.40.0070.00417.01
7.2.30.0040.01516.67
7.2.20.0070.00716.86
7.2.10.0170.00016.62
7.2.00.0070.00718.12
7.1.250.0030.00915.66
7.1.200.0000.01115.82
7.1.100.0000.01417.72
7.1.70.0060.01217.14
7.1.60.0040.02119.40
7.1.50.0080.01216.70
7.1.00.0000.08022.33
7.0.200.0000.00716.89
7.0.140.0130.06022.19
7.0.60.0000.04719.79
7.0.50.0130.07717.99
7.0.40.0030.05320.40
7.0.30.0200.04320.20
7.0.20.0200.07020.10
7.0.10.0330.07720.23
7.0.00.0070.05720.14
5.6.280.0000.07721.02
5.6.210.0100.08020.61
5.6.200.0200.07318.18
5.6.190.0070.04320.52
5.6.180.0330.04720.50
5.6.170.0300.07020.47
5.6.160.0070.06020.51
5.6.150.0130.07318.18
5.6.140.0030.08018.27
5.6.130.0100.04018.28
5.6.120.0070.08320.97
5.6.110.0000.08721.14
5.6.100.0100.08021.14
5.6.90.0070.08321.01
5.6.80.0070.07720.36
5.6.70.3970.03720.38
5.5.350.4300.04020.47
5.5.340.0130.06318.02
5.5.330.0100.08020.41
5.5.320.0170.04320.41
5.5.310.0300.07320.36
5.5.300.0070.05017.99
5.5.290.0070.08318.01
5.5.280.0030.06320.77
5.5.270.0000.06320.74
5.5.260.0070.08320.65
5.5.250.0030.08320.58
5.5.240.0230.06720.16
5.4.450.0070.04019.53
5.4.440.0070.05319.40
5.4.430.0070.07719.18
5.4.420.0100.07719.28
5.4.410.0070.04319.34
5.4.400.0030.06718.98
5.4.320.0130.07019.24
5.4.310.0030.08319.13
5.4.300.0100.07319.24
5.4.290.0070.07718.97
5.4.280.0030.08018.87
5.4.270.0070.06319.02
5.4.260.0070.04019.14
5.4.250.0130.04719.15
5.4.240.0070.06318.91
5.4.230.0100.04719.00
5.4.220.0070.07018.85
5.4.210.0030.05019.14
5.4.200.0030.04719.24
5.4.190.0130.04318.91
5.4.180.0030.04319.00
5.4.170.0100.05018.89
5.4.160.0070.08019.12
5.4.150.0100.07319.10
5.4.140.0130.05016.34
5.4.130.0070.03316.38
5.4.120.0070.07016.39
5.4.110.0000.07716.46
5.4.100.0030.07016.46
5.4.90.0100.05716.54
5.4.80.0070.04016.34
5.4.70.0000.05016.45
5.4.60.0100.06316.41
5.4.50.0000.05316.40
5.4.40.0100.06716.40
5.4.30.0100.06716.27
5.4.20.0100.06016.30
5.4.10.0100.03716.29
5.4.00.0030.03715.76
5.3.290.0030.08014.58
5.3.280.0130.07314.52
5.3.270.0030.07014.76
5.3.260.0000.07014.68
5.3.250.0100.07314.62
5.3.240.0100.04014.64
5.3.230.0030.04014.49
5.3.220.0100.07014.58
5.3.210.0030.04314.73
5.3.200.0200.06714.49
5.3.190.0100.07314.60
5.3.180.0030.07314.72
5.3.170.0030.08314.52
5.3.160.0100.07314.60
5.3.150.0130.03314.61
5.3.140.0070.04014.56
5.3.130.0070.06714.54
5.3.120.0070.04314.44
5.3.110.0100.04714.44
5.3.100.0070.04014.20
5.3.90.0030.03714.04
5.3.80.0070.06014.03
5.3.70.0000.05314.08
5.3.60.0030.04014.07
5.3.50.0030.04313.95
5.3.40.0070.04313.87
5.3.30.0030.06313.84
5.3.20.0170.03313.69
5.3.10.0030.06313.71
5.3.00.0030.04013.64
5.2.170.0030.06011.23
5.2.160.0070.03011.05
5.2.150.0030.06711.19
5.2.140.0070.06011.14
5.2.130.0070.06011.27
5.2.120.0030.05711.08
5.2.110.0000.03711.16
5.2.100.0030.06311.17
5.2.90.0000.03711.10
5.2.80.0030.06011.16
5.2.70.0070.03011.02
5.2.60.0030.03310.96
5.2.50.0130.05310.99
5.2.40.0030.06011.01
5.2.30.0000.06310.87
5.2.20.0070.05710.96
5.2.10.0000.06710.83
5.2.00.0030.06310.88
5.1.60.0070.04310.07
5.1.50.0030.0339.99
5.1.40.0000.0409.94
5.1.30.0030.02310.31
5.1.20.0000.03710.36
5.1.10.0000.0379.99
5.1.00.0030.05310.14
5.0.50.0000.0208.56
5.0.40.0070.0178.39
5.0.30.0030.0608.27
5.0.20.0000.0408.25
5.0.10.0030.0438.17
5.0.00.0070.0408.14
4.4.90.0000.0177.80
4.4.80.0030.0137.80
4.4.70.0070.0337.80
4.4.60.0030.0377.80
4.4.50.0070.0137.80
4.4.40.0070.0507.80
4.4.30.0070.0307.80
4.4.20.0000.0177.82
4.4.10.0000.0177.82
4.4.00.0000.0577.82
4.3.110.0000.0407.82
4.3.100.0000.0377.82
4.3.90.0000.0377.82
4.3.80.0000.0577.82
4.3.70.0000.0277.82
4.3.60.0030.0177.82
4.3.50.0030.0177.82
4.3.40.0070.0477.82
4.3.30.0000.0237.82
4.3.20.0000.0277.82
4.3.10.0000.0337.82
4.3.00.0000.0237.82

preferences:
40.93 ms | 401 KiB | 5 Q