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 exceptionQuestion extends Exception { public function getAnswer($that) { $answerClosure = Closure::bind(function () { return $this->answer; }, $that, $that); $answer = $answerClosure($that); return $answer; } } $e = new exceptionQuestion(); // 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.0100.00718.56
8.3.60.0140.00416.38
8.3.50.0090.00722.04
8.3.40.0170.00018.97
8.3.30.0070.00718.96
8.3.20.0040.00420.25
8.3.10.0030.00521.77
8.3.00.0080.00019.26
8.2.180.0110.01118.54
8.2.170.0140.00722.96
8.2.160.0070.00720.35
8.2.150.0000.00824.18
8.2.140.0040.01124.66
8.2.130.0040.00426.16
8.2.120.0000.00722.27
8.2.110.0090.00022.20
8.2.100.0040.00817.84
8.2.90.0040.00419.08
8.2.80.0030.00517.97
8.2.70.0030.00917.63
8.2.60.0000.00917.93
8.2.50.0050.00318.07
8.2.40.0080.00020.07
8.2.30.0080.00018.07
8.2.20.0000.00817.76
8.2.10.0080.00019.91
8.2.00.0030.00617.72
8.1.280.0160.00625.92
8.1.270.0030.00523.82
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0060.00323.91
8.1.230.0030.00719.16
8.1.220.0070.00017.79
8.1.210.0040.00418.77
8.1.200.0090.00017.35
8.1.190.0040.00417.65
8.1.180.0060.00318.10
8.1.170.0000.00918.50
8.1.160.0040.00421.93
8.1.150.0060.00618.61
8.1.140.0000.00717.39
8.1.130.0030.00317.79
8.1.120.0070.00017.45
8.1.110.0060.00317.44
8.1.100.0040.00417.44
8.1.90.0000.00717.51
8.1.80.0020.00517.48
8.1.70.0030.00317.50
8.1.60.0040.00417.58
8.1.50.0040.00417.45
8.1.40.0040.00417.61
8.1.30.0060.00317.63
8.1.20.0040.00417.65
8.1.10.0040.00417.57
8.1.00.0040.00417.44
8.0.300.0050.00320.74
8.0.290.0000.00717.18
8.0.280.0000.00718.38
8.0.270.0030.00317.18
8.0.260.0030.00317.26
8.0.250.0050.00317.10
8.0.240.0000.00717.01
8.0.230.0030.00317.03
8.0.220.0040.00417.01
8.0.210.0040.00416.95
8.0.200.0000.00717.04
8.0.190.0050.00517.02
8.0.180.0030.00516.97
8.0.170.0070.00017.02
8.0.160.0070.00016.88
8.0.150.0050.00216.98
8.0.140.0040.00416.91
8.0.130.0000.00613.33
8.0.120.0070.00016.94
8.0.110.0000.00716.81
8.0.100.0040.00416.83
8.0.90.0000.00717.08
8.0.80.0100.00716.93
8.0.70.0020.00516.85
8.0.60.0040.00416.85
8.0.50.0000.00716.91
8.0.30.0100.00917.07
8.0.20.0070.01317.40
8.0.10.0040.00417.05
8.0.00.0080.00916.78
7.4.330.0000.00615.00
7.4.320.0000.00616.60
7.4.300.0030.00316.59
7.4.290.0070.00016.65
7.4.280.0080.00016.51
7.4.270.0000.00816.63
7.4.260.0030.00316.52
7.4.250.0040.00416.54
7.4.240.0020.00516.61
7.4.230.0050.00216.59
7.4.220.0030.01616.52
7.4.210.0110.00616.52
7.4.200.0000.00716.48
7.4.190.0070.00016.58
7.4.160.0070.01016.40
7.4.150.0110.00617.40
7.4.140.0160.01017.86
7.4.130.0090.00916.59
7.4.120.0080.00916.43
7.4.110.0150.00316.58
7.4.100.0180.00016.58
7.4.90.0170.00016.59
7.4.80.0030.01319.39
7.4.70.0160.01916.50
7.4.60.0100.00716.54
7.4.50.0040.00416.68
7.4.40.0000.01222.77
7.4.30.0140.00716.47
7.4.00.0090.00614.94
7.3.330.0060.00013.15
7.3.320.0050.00013.23
7.3.310.0040.00316.38
7.3.300.0070.00016.39
7.3.290.0080.00616.44
7.3.280.0080.00816.39
7.3.270.0040.01217.40
7.3.260.0130.00316.57
7.3.250.0060.01016.39
7.3.240.0150.00616.47
7.3.230.0100.00716.49
7.3.210.0170.00316.39
7.3.200.0160.00319.39
7.3.190.0090.01216.52
7.3.180.0060.00916.43
7.3.170.0030.01616.41
7.3.160.0160.00016.54
7.3.120.0070.01014.52
7.2.330.0070.01016.71
7.2.320.0170.00316.73
7.2.310.0130.00416.83
7.2.300.0090.00916.74
7.2.290.0180.00016.60
7.2.60.0060.00317.04
7.1.200.0030.01015.77
7.1.70.0160.00316.98
7.1.60.0100.01419.46
7.1.50.0090.01216.98
7.1.00.0030.07722.40
7.0.200.0080.00016.77
7.0.140.0000.07321.95
7.0.110.0100.08720.04
7.0.100.0100.04720.11
7.0.90.0170.08020.00
7.0.80.0130.06719.94
7.0.70.0030.08320.02
7.0.60.0030.06719.94
7.0.50.0170.08320.30
7.0.40.0070.08319.96
7.0.30.0100.07720.16
7.0.20.0000.08720.19
7.0.10.0100.08019.95
7.0.00.0030.08320.12
5.6.280.0070.07021.08
5.6.260.0100.08320.63
5.6.250.0170.07020.68
5.6.240.0030.08020.55
5.6.230.0030.08320.65
5.6.220.0230.06320.70
5.6.210.0130.07720.59
5.6.200.0030.07321.06
5.6.190.0030.08321.04
5.6.180.0030.08021.11
5.6.170.0030.08321.15
5.6.160.0030.08720.97
5.6.150.0030.08321.09
5.6.140.0170.07021.29
5.6.130.0200.07321.15
5.6.120.0170.04020.95
5.6.110.0100.07020.94
5.6.100.0200.06321.19
5.6.90.0070.05021.07
5.6.80.0030.04020.45
5.6.70.0200.04320.68
5.6.60.0100.07320.31
5.6.50.0000.05020.66
5.6.40.0030.04320.65
5.6.30.0000.04320.32
5.6.20.0100.03320.41
5.6.10.0070.03720.42
5.6.00.0030.04020.60
5.5.380.0170.07020.43
5.5.370.0130.07320.33
5.5.360.0000.08720.37
5.5.350.0100.07320.42
5.5.340.0100.04720.96
5.5.330.0200.07020.72
5.5.320.0130.07021.03
5.5.310.0130.07320.92
5.5.300.0100.07720.98
5.5.290.0130.07320.80
5.5.280.0070.08320.97
5.5.270.0070.04320.78
5.5.260.0100.08020.91
5.5.250.0100.07320.71
5.5.240.0070.08320.38
5.5.230.0130.06720.28
5.5.220.0130.06720.40
5.5.210.0130.07320.21
5.5.200.0030.04020.35
5.5.190.0070.05320.38
5.5.180.0070.03720.20
5.5.160.0070.03720.25
5.5.150.0030.03720.31
5.5.140.0130.03020.12
5.5.130.0100.03320.25
5.5.120.0100.03720.27
5.5.110.0000.04020.39
5.5.100.0070.03720.10
5.5.90.0100.03320.26
5.5.80.0130.05020.06
5.5.70.0070.06320.05
5.5.60.0100.07320.00
5.5.50.0030.05320.05
5.5.40.0100.07320.26
5.5.30.0030.06720.07
5.5.20.0070.03720.27
5.5.10.0070.06020.01
5.5.00.0030.05720.11
5.4.450.0070.07319.34
5.4.440.0130.06719.27
5.4.430.0030.08719.32
5.4.420.0070.07319.51
5.4.410.0100.06319.38
5.4.400.0000.08318.95
5.4.390.0100.07719.33
5.4.380.0100.07019.34
5.4.370.0100.05019.03
5.4.360.0100.04019.04
5.4.350.0100.03719.32
5.4.340.0000.04019.14
5.4.320.0000.04319.00
5.4.310.0000.04019.03
5.4.300.0000.03719.17
5.4.290.0030.03718.97
5.4.280.0070.03319.14
5.4.270.0030.06019.16
5.4.260.0030.07319.16
5.4.250.0000.04319.14
5.4.240.0000.07719.23
5.4.230.0030.07019.16
5.4.220.0000.08019.13
5.4.210.0070.05719.05
5.4.200.0130.06019.18
5.4.190.0030.04018.94
5.4.180.0070.05019.13
5.4.170.0070.06319.31
5.4.160.0030.05718.99
5.4.150.0030.03719.23
5.4.140.0030.03716.52
5.4.130.0030.03316.33
5.4.120.0030.03716.59
5.4.110.0000.05016.50
5.4.100.0000.05316.48
5.4.90.0070.03316.46
5.4.80.0030.03316.46
5.4.70.0100.03316.30
5.4.60.0070.04016.29
5.4.50.0070.03016.29
5.4.40.0100.02716.62
5.4.30.0070.03016.44
5.4.20.0030.03316.33
5.4.10.0030.03716.47
5.4.00.0030.04015.68
5.3.290.0000.04014.67
5.3.280.0030.05714.76
5.3.270.0070.03714.66
5.3.260.0000.04014.47
5.3.250.0000.03714.70
5.3.240.0000.04014.59
5.3.230.0070.03314.60
5.3.220.0000.04014.80
5.3.210.0070.03714.72
5.3.200.0070.03014.61
5.3.190.0100.03014.70
5.3.180.0000.04714.71
5.3.170.0030.03714.53
5.3.160.0070.03014.70
5.3.150.0070.03714.66
5.3.140.0070.03314.43
5.3.130.0000.03714.57
5.3.120.0030.04314.70
5.3.110.0070.03314.41
5.3.100.0030.05714.20
5.3.90.0030.04714.26
5.3.80.0000.04014.09
5.3.70.0070.03314.09
5.3.60.0030.03714.14
5.3.50.0030.03714.05
5.3.40.0000.04014.11
5.3.30.0000.04713.91
5.3.20.0030.07313.66
5.3.10.0100.06713.66
5.3.00.0000.04313.53
5.2.170.0070.03311.57
5.2.160.0030.02711.57
5.2.150.0030.02711.57
5.2.140.0000.03011.57
5.2.130.0030.06711.57
5.2.120.0030.06311.57
5.2.110.0100.05311.57
5.2.100.0130.05311.57
5.2.90.0100.02311.57
5.2.80.0070.06011.57
5.2.70.0100.03711.57
5.2.60.0070.06011.57
5.2.50.0070.05711.57
5.2.40.0030.05711.57
5.2.30.0070.06011.57
5.2.20.0000.05711.57
5.2.10.0030.06311.57
5.2.00.0030.04711.57
5.1.60.0100.04711.57
5.1.50.0100.05011.57
5.1.40.0030.02711.57
5.1.30.0100.05311.57
5.1.20.0030.05011.57
5.1.10.0070.05311.57
5.1.00.0070.05011.57
5.0.50.0030.02011.57
5.0.40.0100.03311.57
5.0.30.0100.06311.57
5.0.20.0000.04311.57
5.0.10.0070.03011.57
5.0.00.0070.04711.57
4.4.90.0070.03011.57
4.4.80.0100.02311.57
4.4.70.0030.02311.57
4.4.60.0100.03011.57
4.4.50.0100.01311.57
4.4.40.0070.05011.57
4.4.30.0000.03311.57
4.4.20.0000.02011.57
4.4.10.0070.01311.57
4.4.00.0030.04311.57
4.3.110.0030.03311.57
4.3.100.0000.02311.57
4.3.90.0030.03311.57
4.3.80.0000.05711.57
4.3.70.0030.03311.57
4.3.60.0000.03711.57
4.3.50.0000.02711.57
4.3.40.0130.04311.57
4.3.30.0000.03711.57
4.3.20.0000.03711.57
4.3.10.0000.03711.57
4.3.00.0000.03711.57

preferences:
37.89 ms | 401 KiB | 5 Q