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 Hello extends Exception { public function getAnswer($class) { $val = (new ReflectionClass('Question'))->getProperty('answer'); $val->setAccessible(true); return $val->getValue($class); } } $e = new Hello(); // 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.30
8.3.50.0090.00921.09
8.3.40.0090.00618.84
8.3.30.0140.00318.93
8.3.20.0080.00020.33
8.3.10.0000.00822.09
8.3.00.0000.00722.46
8.2.180.0150.00316.75
8.2.170.0110.00422.96
8.2.160.0070.00720.43
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0030.00626.16
8.2.120.0050.00320.94
8.2.110.0030.00622.07
8.2.100.0090.00317.84
8.2.90.0000.00919.06
8.2.80.0040.00419.12
8.2.70.0000.00917.75
8.2.60.0000.01018.05
8.2.50.0000.00818.07
8.2.40.0000.00818.16
8.2.30.0000.00818.11
8.2.20.0000.00717.80
8.2.10.0040.00417.68
8.2.00.0040.00417.81
8.1.280.0130.00325.92
8.1.270.0000.00920.27
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0030.00723.96
8.1.230.0040.00719.00
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0000.00917.36
8.1.190.0060.00317.63
8.1.180.0060.00320.25
8.1.170.0000.00818.55
8.1.160.0030.00522.15
8.1.150.0000.00818.56
8.1.140.0070.00017.39
8.1.130.0030.00317.78
8.1.120.0040.00417.53
8.1.110.0040.00417.47
8.1.100.0030.00517.50
8.1.90.0000.00717.48
8.1.80.0000.00817.38
8.1.70.0000.00717.50
8.1.60.0040.00417.60
8.1.50.0030.00617.58
8.1.40.0000.00817.45
8.1.30.0000.00717.48
8.1.20.0050.00317.67
8.1.10.0040.00417.50
8.1.00.0080.00017.50
8.0.300.0070.00018.77
8.0.290.0060.00317.17
8.0.280.0040.00418.54
8.0.270.0000.00717.27
8.0.260.0030.00316.79
8.0.250.0070.00017.07
8.0.240.0030.00516.99
8.0.230.0040.00216.97
8.0.220.0030.00316.87
8.0.210.0000.00716.96
8.0.200.0030.00316.96
8.0.190.0000.00716.89
8.0.180.0080.00016.98
8.0.170.0030.00617.02
8.0.160.0000.00816.94
8.0.150.0040.00417.00
8.0.140.0000.00916.90
8.0.130.0050.00013.39
8.0.120.0060.00316.95
8.0.110.0040.00416.96
8.0.100.0000.00716.77
8.0.90.0000.00716.79
8.0.80.0130.00917.02
8.0.70.0080.00016.85
8.0.60.0050.00316.93
8.0.50.0040.00416.84
8.0.30.0090.01216.82
8.0.20.0100.00817.40
8.0.10.0040.00417.09
8.0.00.0100.01016.88
7.4.330.0020.00215.00
7.4.320.0020.00516.62
7.4.300.0030.00316.59
7.4.290.0000.00716.59
7.4.280.0070.00016.50
7.4.270.0000.00716.43
7.4.260.0000.00716.52
7.4.250.0040.00416.56
7.4.240.0030.00516.64
7.4.230.0000.00716.52
7.4.220.0140.00616.61
7.4.210.0070.00816.52
7.4.200.0000.00716.34
7.4.190.0030.00316.43
7.4.160.0100.00616.46
7.4.150.0100.00717.40
7.4.140.0090.01217.86
7.4.130.0110.00616.46
7.4.120.0100.00916.64
7.4.110.0150.00616.52
7.4.100.0060.01216.56
7.4.90.0100.01316.59
7.4.80.0090.01219.39
7.4.70.0110.00716.78
7.4.60.0090.00916.45
7.4.50.0040.00416.43
7.4.40.0110.00422.77
7.4.30.0100.00716.42
7.4.00.0070.01015.23
7.3.330.0020.00213.23
7.3.320.0000.00513.39
7.3.310.0070.00016.33
7.3.300.0040.00416.39
7.3.290.0060.00916.36
7.3.280.0110.00616.36
7.3.270.0060.01217.40
7.3.260.0230.01716.45
7.3.250.0090.00916.53
7.3.240.0060.01416.50
7.3.230.0100.01316.39
7.3.210.0140.00316.50
7.3.200.0060.01119.39
7.3.190.0060.01616.29
7.3.180.0070.01316.63
7.3.170.0060.01016.59
7.3.160.0000.01516.50
7.3.120.0060.00914.94
7.2.330.0070.01316.81
7.2.320.0070.01116.72
7.2.310.0070.01016.43
7.2.300.0060.01016.87
7.2.290.0110.00616.60
7.2.00.0030.01419.46
7.1.100.0080.00818.35
7.1.70.0030.00517.03
7.1.60.0100.00719.50
7.1.50.0030.01616.86
7.1.00.0030.04022.32
7.0.200.0000.00916.75
7.0.140.0030.07322.14
7.0.60.0100.08319.75
7.0.50.0030.06317.95
7.0.40.0070.08320.14
7.0.30.0300.08020.20
7.0.20.0130.05020.19
7.0.10.0030.05720.09
7.0.00.0130.05720.20
5.6.280.0000.07720.91
5.6.210.0130.07320.48
5.6.200.0070.05018.20
5.6.190.0070.07320.42
5.6.180.0400.07020.58
5.6.170.0330.03720.71
5.6.160.0170.07320.43
5.6.150.0100.04718.27
5.6.140.0030.04018.27
5.6.130.0100.06718.28
5.6.120.0070.08720.90
5.6.110.0100.03721.07
5.6.100.0130.04721.01
5.6.90.0170.07720.98
5.6.80.0030.08720.41
5.6.70.3570.02020.40
5.5.350.0070.04020.43
5.5.340.0100.07718.05
5.5.330.0030.08720.57
5.5.320.0200.04320.24
5.5.310.0300.05320.34
5.5.300.0100.08017.98
5.5.290.0100.07718.08
5.5.280.0130.08020.91
5.5.270.0100.08320.87
5.5.260.0070.05320.84
5.5.250.0130.07720.49
5.5.240.0070.05020.28
5.4.450.0930.05719.47
5.4.440.1030.05019.61
5.4.430.0770.05319.69
5.4.420.0900.06019.30
5.4.410.0900.04719.57
5.4.400.0430.07018.75
5.4.390.0570.05318.56
5.4.380.0200.06018.50
5.4.370.0130.05318.74
5.4.360.0100.05318.75
5.4.350.0050.03912.02
5.4.340.0070.04312.02
5.4.320.0060.04412.50
5.4.310.0070.04012.50
5.4.300.0090.04212.50
5.4.290.0060.04312.50
5.4.280.0100.04512.40
5.4.270.0090.03812.39
5.4.260.0060.04012.40
5.4.250.0170.06319.00
5.4.240.0130.06718.95
5.4.230.0030.05718.96
5.4.220.0130.06318.74
5.4.210.0130.05018.99
5.4.200.0100.05319.08
5.4.190.0170.06318.95
5.4.180.0100.05319.02
5.4.170.0170.04718.92
5.4.160.0100.05718.91
5.4.150.0070.08018.80
5.4.140.0130.04716.49
5.4.130.0030.07316.64
5.4.120.0070.05016.36
5.4.110.0100.05016.58
5.4.100.0100.06016.53
5.4.90.0100.04716.43
5.4.80.0070.07016.51
5.4.70.0070.05016.55
5.4.60.0100.05316.47
5.4.50.0100.06016.38
5.4.40.0030.06716.44
5.4.30.0100.06716.61
5.4.20.0170.06316.44
5.4.10.0170.04716.33
5.4.00.0100.06715.81
5.3.290.0040.04912.80
5.3.280.0130.06314.68
5.3.270.0170.07014.84
5.3.260.0100.05014.77
5.3.250.0170.06714.63
5.3.240.0070.05314.77
5.3.230.0170.04014.79
5.3.220.0070.05014.56
5.3.210.0030.05714.66
5.3.200.0000.06314.48
5.3.190.0070.05714.47
5.3.180.0170.06314.73
5.3.170.0070.05714.57
5.3.160.0170.07014.63
5.3.150.0100.05014.56
5.3.140.0030.07014.65
5.3.130.0070.05714.39
5.3.120.0070.05714.54
5.3.110.0170.06314.38
5.3.100.0100.04714.04
5.3.90.0030.08013.85
5.3.80.0070.05013.86
5.3.70.0000.08014.00
5.3.60.0070.06314.22
5.3.50.0170.05014.13
5.3.40.0070.06014.11
5.3.30.0130.04014.00
5.3.20.0130.04713.68
5.3.10.0030.05013.73
5.3.00.0030.05313.73
5.2.170.0100.04311.14
5.2.160.0030.04711.13
5.2.150.0130.03711.30
5.2.140.0000.04711.36
5.2.130.0030.04011.08
5.2.120.0100.04711.32
5.2.110.0070.04010.93
5.2.100.0100.05011.09
5.2.90.0030.05011.09
5.2.80.0030.05310.93
5.2.70.0070.04311.26
5.2.60.0100.04011.14
5.2.50.0100.03311.18
5.2.40.0100.03311.22
5.2.30.0100.04711.05
5.2.20.0070.03710.79
5.2.10.0070.03710.95
5.2.00.0070.04010.84
5.1.60.0000.03710.00
5.1.50.0070.03310.09
5.1.40.0000.05310.02
5.1.30.0030.03710.43
5.1.20.0030.05710.58
5.1.10.0100.04310.16
5.1.00.0070.04710.04
5.0.50.0030.0338.56
5.0.40.0070.0278.56
5.0.30.0100.0538.14
5.0.20.0000.0308.35
5.0.10.0000.0338.18
5.0.00.0070.0378.08
4.4.90.0000.0237.34
4.4.80.0070.0207.34
4.4.70.0030.0207.34
4.4.60.0070.0177.34
4.4.50.0030.0237.34
4.4.40.0000.0407.34
4.4.30.0070.0177.34
4.4.20.0000.0277.36
4.4.10.0030.0207.36
4.4.00.0070.0307.36
4.3.110.0200.0307.36
4.3.100.0070.0277.36
4.3.90.0070.0177.36
4.3.80.0030.0307.36
4.3.70.0000.0237.36
4.3.60.0000.0237.36
4.3.50.0000.0237.36
4.3.40.0100.0237.36
4.3.30.0000.0277.36
4.3.20.0000.0277.36
4.3.10.0000.0237.36
4.3.00.0130.0206.90

preferences:
40.16 ms | 401 KiB | 5 Q