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.60.0090.00916.84
8.3.50.0070.01322.00
8.3.40.0160.00418.76
8.3.30.0140.00019.19
8.3.20.0000.00820.16
8.3.10.0050.00321.75
8.3.00.0030.00619.26
8.2.180.0140.00718.41
8.2.170.0180.00022.96
8.2.160.0030.01420.52
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0130.00626.16
8.2.120.0000.00722.20
8.2.110.0090.00019.32
8.2.100.0000.01117.84
8.2.90.0040.00419.12
8.2.80.0080.00017.97
8.2.70.0040.00417.75
8.2.60.0070.00417.93
8.2.50.0060.00318.10
8.2.40.0000.00818.16
8.2.30.0080.00018.12
8.2.20.0030.00617.79
8.2.10.0060.00317.95
8.2.00.0070.00417.68
8.1.280.0190.00325.92
8.1.270.0040.00422.05
8.1.260.0050.00226.35
8.1.250.0000.00728.09
8.1.240.0040.00718.93
8.1.230.0040.00717.82
8.1.220.0030.00517.77
8.1.210.0000.00818.77
8.1.200.0090.00017.25
8.1.190.0040.00417.23
8.1.180.0000.00818.10
8.1.170.0080.00318.57
8.1.160.0040.00422.02
8.1.150.0090.00018.64
8.1.140.0000.00717.53
8.1.130.0080.00017.88
8.1.120.0040.00417.45
8.1.110.0040.00417.50
8.1.100.0040.00417.48
8.1.90.0000.00717.50
8.1.80.0000.00717.44
8.1.70.0040.00417.41
8.1.60.0060.00317.45
8.1.50.0000.00917.41
8.1.40.0080.00017.54
8.1.30.0040.00417.50
8.1.20.0000.00717.64
8.1.10.0040.00417.64
8.1.00.0080.00017.41
8.0.300.0000.00718.77
8.0.290.0000.00816.63
8.0.280.0070.00018.45
8.0.270.0000.00717.18
8.0.260.0030.00317.22
8.0.250.0000.00717.00
8.0.240.0030.00316.91
8.0.230.0000.00816.98
8.0.220.0000.00616.92
8.0.210.0020.00516.87
8.0.200.0060.00017.00
8.0.190.0000.00917.00
8.0.180.0000.00717.01
8.0.170.0040.00417.01
8.0.160.0040.00416.91
8.0.150.0040.00416.99
8.0.140.0070.00016.93
8.0.130.0000.00613.42
8.0.120.0050.00316.81
8.0.110.0040.00416.95
8.0.100.0080.00017.01
8.0.90.0040.00416.75
8.0.80.0070.01116.93
8.0.70.0050.00316.76
8.0.60.0070.00016.96
8.0.50.0070.00016.91
8.0.30.0120.00617.19
8.0.20.0140.00617.40
8.0.10.0040.00416.91
8.0.00.0090.01116.95
7.4.330.0000.00615.00
7.4.320.0000.00616.44
7.4.300.0030.00316.66
7.4.290.0030.00316.63
7.4.280.0040.00416.53
7.4.270.0000.00816.51
7.4.260.0000.00716.50
7.4.250.0060.00316.41
7.4.240.0000.00716.54
7.4.230.0040.00416.41
7.4.220.0070.01016.54
7.4.210.0110.00816.65
7.4.200.0050.00316.69
7.4.190.0040.00416.37
7.4.160.0080.00816.43
7.4.150.0130.00317.40
7.4.140.0130.00517.86
7.4.130.0090.00916.47
7.4.120.0050.01316.56
7.4.110.0100.01316.46
7.4.100.0090.00916.53
7.4.90.0060.01016.42
7.4.80.0090.00919.39
7.4.70.0060.01016.50
7.4.60.0100.00716.46
7.4.50.0080.00016.55
7.4.40.0120.00622.77
7.4.30.0090.01216.56
7.4.00.0030.00915.13
7.3.330.0060.00013.36
7.3.320.0040.00413.18
7.3.310.0000.00716.35
7.3.300.0000.00816.28
7.3.290.0030.01616.41
7.3.280.0110.00416.32
7.3.270.0080.00917.40
7.3.260.0090.00916.66
7.3.250.0120.00916.48
7.3.240.0130.00616.41
7.3.230.0100.00716.40
7.3.210.0000.01716.46
7.3.200.0160.00319.39
7.3.190.0120.00916.48
7.3.180.0030.01316.30
7.3.170.0090.00616.49
7.3.160.0090.00616.59
7.3.120.0090.00615.01
7.2.330.0070.01016.81
7.2.320.0110.00716.77
7.2.310.0100.00716.62
7.2.300.0000.01716.79
7.2.290.0060.01016.55
7.2.00.0040.00819.53
7.1.100.0040.01118.23
7.1.70.0040.00416.86
7.1.60.0040.00717.30
7.1.50.0040.01816.91
7.1.00.0070.07022.36
7.0.200.0030.01316.78
7.0.140.0100.06021.93
7.0.60.0030.04019.98
7.0.50.0200.06717.87
7.0.40.0030.04720.13
7.0.30.0200.04320.12
7.0.20.0230.04020.21
7.0.10.0000.08020.15
7.0.00.0100.05720.10
5.6.280.0000.07721.08
5.6.210.0100.07720.77
5.6.200.0030.07018.24
5.6.190.0070.04320.50
5.6.180.0130.05320.39
5.6.170.0270.05720.62
5.6.160.0000.04720.55
5.6.150.0030.08318.27
5.6.140.0030.05018.28
5.6.130.0000.04718.17
5.6.120.0070.04721.11
5.6.110.0130.07721.00
5.6.100.0100.06720.97
5.6.90.0100.04021.12
5.6.80.0030.04020.55
5.5.350.0300.06320.43
5.5.340.0100.07317.98
5.5.330.0070.04720.25
5.5.320.0370.07020.27
5.5.310.0300.06720.24
5.5.300.0200.07017.95
5.5.290.0070.08017.97
5.5.280.0030.06320.77
5.5.270.0070.05020.80
5.5.260.0170.07020.99
5.5.250.0070.03720.79
5.5.240.3000.03320.13
5.4.450.0800.06319.16
5.4.440.0770.05719.53
5.4.430.0600.05019.15
5.4.420.0630.05719.29
5.4.410.0630.05319.54
5.4.400.0830.05019.23
5.4.390.0630.05019.12
5.4.380.0470.06018.82
5.4.370.0300.05018.84
5.4.360.0430.05018.70
5.4.350.0400.04718.48
5.4.340.0230.06318.80
5.4.320.0060.04412.52
5.4.310.0080.04112.51
5.4.300.0120.03112.52
5.4.290.0060.04012.49
5.4.280.0070.03512.39
5.4.270.0040.03912.39
5.4.260.0070.03712.39
5.4.250.0090.03612.38
5.4.240.0100.05112.39
5.4.230.0070.05012.38
5.4.220.0100.04212.38
5.4.210.0070.04212.38
5.4.200.0090.04712.38
5.4.190.0120.03712.38
5.4.180.0110.03612.37
5.4.170.0060.04912.38
5.4.160.0090.04312.39
5.4.150.0110.03312.38
5.4.140.0040.04712.06
5.4.130.0100.03612.05
5.4.120.0100.04612.01
5.4.110.0050.05212.00
5.4.100.0080.03912.00
5.4.90.0080.05412.01
5.4.80.0130.03812.00
5.4.70.0140.04012.00
5.4.60.0090.05212.00
5.4.50.0130.06312.00
5.4.40.0100.04511.99
5.4.30.0150.06311.98
5.4.20.0080.04211.99
5.4.10.0040.04111.98
5.4.00.0070.04011.47
5.3.290.0070.04412.80
5.3.280.0080.03912.71
5.3.270.0070.05012.72
5.3.260.0130.05112.72
5.3.250.0100.05412.72
5.3.240.0070.04912.72
5.3.230.0080.05612.71
5.3.220.0120.05112.68
5.3.210.0150.04512.68
5.3.200.0070.04212.68
5.3.190.0060.04212.68
5.3.180.0100.03812.68
5.3.170.0110.03512.67
5.3.160.0080.04812.67
5.3.150.0060.05612.67
5.3.140.0080.03912.66
5.3.130.0110.05212.66
5.3.120.0070.05712.65
5.3.110.0060.04712.66
5.3.100.0110.03512.13
5.3.90.0040.04012.12
5.3.80.0080.03612.11
5.3.70.0090.03512.11
5.3.60.0080.03512.09
5.3.50.0070.03512.04
5.3.40.0090.04112.04
5.3.30.0080.05212.00
5.3.20.0090.05111.78
5.3.10.0070.05411.74
5.3.00.0060.05511.73
5.2.170.0050.0429.22
5.2.160.0060.0319.23
5.2.150.0070.0309.22
5.2.140.0060.0329.21
5.2.130.0060.0299.18
5.2.120.0040.0309.18
5.2.110.0070.0289.19
5.2.100.0090.0279.19
5.2.90.0080.0289.19
5.2.80.0080.0359.18
5.2.70.0090.0299.18
5.2.60.0080.0409.14
5.2.50.0140.0459.11
5.2.40.0070.0439.08
5.2.30.0050.0459.06
5.2.20.0070.0339.04
5.2.10.0070.0278.95
5.2.00.0020.0348.82
5.1.60.0050.0288.09
5.1.50.0060.0268.09
5.1.40.0060.0258.07
5.1.30.0030.0308.42
5.1.20.0080.0268.45
5.1.10.0070.0308.17
5.1.00.0060.0328.17
5.0.50.0030.0216.65
5.0.40.0040.0216.50
5.0.30.0030.0416.32
5.0.20.0060.0186.28
5.0.10.0030.0256.27
5.0.00.0070.0286.26
4.4.90.0020.0164.77
4.4.80.0020.0184.75
4.4.70.0030.0164.75
4.4.60.0040.0154.75
4.4.50.0040.0154.77
4.4.40.0030.0314.71
4.4.30.0040.0154.76
4.4.20.0040.0144.85
4.4.10.0020.0174.85
4.4.00.0020.0264.76
4.3.110.0040.0164.66
4.3.100.0030.0164.66
4.3.90.0030.0154.63
4.3.80.0050.0244.58
4.3.70.0040.0214.63
4.3.60.0030.0224.63
4.3.50.0020.0234.63
4.3.40.0020.0344.54
4.3.30.0030.0193.30
4.3.20.0020.0193.28
4.3.10.0030.0153.24
4.3.00.0270.03010.54

preferences:
32.38 ms | 401 KiB | 5 Q