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 exceptionFun extends Exception { public function getAnswer($that) { $getTheAnswer = Closure::bind($this->getPrivate(),$that); $result = $getTheAnswer($that); return $result; } public function getPrivate($that) { return $that->answer; } } $e = new exceptionFun(); // 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.01118.40
8.3.50.0140.00821.99
8.3.40.0110.00718.79
8.3.30.0120.00619.18
8.3.20.0070.01020.38
8.3.10.0060.00323.57
8.3.00.0080.00019.26
8.2.180.0030.01216.88
8.2.170.0090.00622.96
8.2.160.0130.00020.38
8.2.150.0040.00424.18
8.2.140.0050.00224.66
8.2.130.0080.00026.16
8.2.120.0070.00022.17
8.2.110.0050.00522.27
8.2.100.0070.00317.72
8.2.90.0030.00619.17
8.2.80.0030.00518.03
8.2.70.0080.00017.63
8.2.60.0080.00417.80
8.2.50.0050.00618.07
8.2.40.0000.00819.76
8.2.30.0030.00517.94
8.2.20.0000.00717.71
8.2.10.0000.00718.05
8.2.00.0040.00417.81
8.1.280.0090.00625.92
8.1.270.0060.00323.88
8.1.260.0090.00026.35
8.1.250.0040.00428.09
8.1.240.0030.00623.91
8.1.230.0000.01219.16
8.1.220.0050.00317.74
8.1.210.0060.00318.77
8.1.200.0100.00017.38
8.1.190.0050.00317.53
8.1.180.0060.00318.10
8.1.170.0080.00018.66
8.1.160.0070.00022.04
8.1.150.0080.00318.66
8.1.140.0040.00417.39
8.1.130.0030.00317.87
8.1.120.0050.00317.48
8.1.110.0000.00717.55
8.1.100.0100.00017.51
8.1.90.0000.00817.52
8.1.80.0050.00217.50
8.1.70.0040.00417.48
8.1.60.0080.00017.63
8.1.50.0000.00817.46
8.1.40.0030.00517.58
8.1.30.0040.00417.65
8.1.20.0040.00417.66
8.1.10.0000.00717.50
8.1.00.0070.00017.48
8.0.300.0040.00418.96
8.0.290.0000.00717.18
8.0.280.0000.00818.45
8.0.270.0000.00717.12
8.0.260.0000.00617.19
8.0.250.0000.00716.98
8.0.240.0000.00716.91
8.0.230.0020.00516.86
8.0.220.0000.00716.93
8.0.210.0030.00316.93
8.0.200.0060.00016.85
8.0.190.0080.00016.99
8.0.180.0000.01216.84
8.0.170.0040.00416.82
8.0.160.0000.00716.93
8.0.150.0030.00516.83
8.0.140.0040.00416.99
8.0.130.0060.00013.40
8.0.120.0080.00016.90
8.0.110.0050.00316.91
8.0.100.0040.00416.86
8.0.90.0040.00417.09
8.0.80.0070.01316.90
8.0.70.0040.00416.88
8.0.60.0060.00316.82
8.0.50.0040.00416.82
8.0.30.0120.00617.14
8.0.20.0110.00817.40
8.0.10.0000.00717.04
8.0.00.0060.01216.81
7.4.330.0000.00515.00
7.4.320.0030.00316.53
7.4.300.0000.00716.55
7.4.290.0070.00016.63
7.4.280.0030.00316.60
7.4.270.0070.00016.54
7.4.260.0030.00316.59
7.4.250.0080.00016.49
7.4.240.0040.00416.58
7.4.230.0050.00216.54
7.4.220.0120.00616.59
7.4.210.0110.00516.61
7.4.200.0000.00716.45
7.4.190.0070.00016.49
7.4.160.0040.01216.72
7.4.150.0160.00417.40
7.4.140.0090.00917.86
7.4.130.0080.00816.51
7.4.120.0120.00916.62
7.4.110.0080.00816.68
7.4.100.0120.00716.47
7.4.90.0090.00916.46
7.4.80.0050.01519.39
7.4.70.0030.01316.51
7.4.60.0100.00616.54
7.4.50.0000.00916.32
7.4.40.0080.00422.77
7.4.30.0120.00416.69
7.4.00.0060.00814.83
7.3.330.0030.00313.33
7.3.320.0000.00613.18
7.3.310.0000.00716.40
7.3.300.0090.00016.20
7.3.290.0110.00316.38
7.3.280.0060.00916.31
7.3.270.0090.00917.40
7.3.260.0100.01416.28
7.3.250.0080.01216.41
7.3.240.0060.01116.30
7.3.230.0130.00316.39
7.3.210.0000.01616.39
7.3.200.0040.00319.39
7.3.190.0110.00616.42
7.3.180.0030.01316.60
7.3.170.0100.00616.50
7.3.160.0090.00916.38
7.3.120.0070.00714.67
7.2.330.0130.00316.68
7.2.320.0090.00916.63
7.2.310.0080.00816.52
7.2.300.0100.00616.68
7.2.290.0100.01016.64
7.2.60.0000.01316.94
7.2.00.0030.01019.45
7.1.200.0030.01015.71
7.1.100.0040.00818.29
7.1.70.0040.00417.00
7.1.60.0030.01519.46
7.1.50.0090.00416.90
7.1.00.0070.07322.33
7.0.200.0060.00316.75
7.0.140.0030.07021.95
7.0.60.0200.07019.93
7.0.50.0030.08717.88
7.0.40.0230.07020.09
7.0.30.0300.07720.23
7.0.20.0230.03320.22
7.0.10.0100.08720.10
7.0.00.0100.04320.05
5.6.280.0030.07021.13
5.6.210.0070.07320.48
5.6.200.0030.05718.20
5.6.190.0130.06720.55
5.6.180.0330.04320.55
5.6.170.0230.06320.47
5.6.160.0100.05020.45
5.6.150.0100.03318.18
5.6.140.0130.07718.14
5.6.130.0070.08718.16
5.6.120.0030.06021.00
5.6.110.0100.06321.14
5.6.100.0030.08321.00
5.6.90.0030.09021.01
5.6.80.0070.03320.42
5.5.350.0270.03320.38
5.5.340.0070.04017.98
5.5.330.0200.07020.13
5.5.320.0030.04020.34
5.5.310.0330.06020.30
5.5.300.0070.08017.98
5.5.290.0130.07317.98
5.5.280.0170.06720.81
5.5.270.0100.08320.86
5.5.260.0100.08020.68
5.5.250.0130.07720.69
5.5.240.0030.08020.27
5.4.450.0500.04319.61
5.4.440.0130.05719.47
5.4.430.0100.05719.41
5.4.420.0030.06019.44
5.4.410.0030.06019.52
5.4.400.0130.04719.26
5.4.390.0070.05319.13
5.4.380.0300.05718.59
5.4.370.0330.05018.74
5.4.360.0330.05318.63
5.4.350.0330.05018.76
5.4.340.0400.05018.75
5.4.320.0060.03912.51
5.4.310.0080.04212.50
5.4.300.0090.03812.50
5.4.290.0040.04312.48
5.4.280.0050.04712.39
5.4.270.0050.06212.39
5.4.260.0060.04112.39
5.4.250.0060.04012.38
5.4.240.0060.03812.38
5.4.230.0090.03712.37
5.4.220.0120.04512.38
5.4.210.0090.05112.37
5.4.200.0070.04612.37
5.4.190.0080.03512.37
5.4.180.0060.03912.38
5.4.170.0040.04012.39
5.4.160.0070.03612.38
5.4.150.0050.03712.38
5.4.140.0070.03712.06
5.4.130.0040.03912.05
5.4.120.0050.03712.01
5.4.110.0060.04412.00
5.4.100.0050.03712.00
5.4.90.0050.03912.00
5.4.80.0040.03912.00
5.4.70.0070.03712.00
5.4.60.0070.03612.00
5.4.50.0080.03512.00
5.4.40.0090.03311.98
5.4.30.0080.03511.98
5.4.20.0080.03411.98
5.4.10.0050.03611.98
5.4.00.0100.03311.47
5.3.290.0040.04112.80
5.3.280.0040.04312.70
5.3.270.0110.04512.72
5.3.260.0090.04012.72
5.3.250.0100.03712.72
5.3.240.0070.04312.72
5.3.230.0090.03812.71
5.3.220.0060.04612.68
5.3.210.0090.03812.68
5.3.200.0080.04212.68
5.3.190.0070.04112.68
5.3.180.0110.04012.67
5.3.170.0080.03712.67
5.3.160.0100.04112.67
5.3.150.0080.05012.68
5.3.140.0080.04412.66
5.3.130.0060.05012.66
5.3.120.0100.06112.66
5.3.110.0060.05312.66
5.3.100.0090.03612.13
5.3.90.0090.03612.11
5.3.80.0100.03612.10
5.3.70.0070.04012.11
5.3.60.0050.03912.09
5.3.50.0100.03312.04
5.3.40.0070.04212.04
5.3.30.0110.03412.00
5.3.20.0060.03611.78
5.3.10.0060.03811.74
5.3.00.0050.03811.73
5.2.170.0060.0309.23
5.2.160.0030.0369.23
5.2.150.0070.0359.23
5.2.140.0080.0429.23
5.2.130.0080.0389.19
5.2.120.0100.0499.19
5.2.110.0070.0429.20
5.2.100.0060.0289.19
5.2.90.0030.0329.20
5.2.80.0050.0309.19
5.2.70.0040.0309.18
5.2.60.0060.0289.14
5.2.50.0050.0359.11
5.2.40.0050.0299.09
5.2.30.0070.0279.06
5.2.20.0040.0309.05
5.2.10.0060.0278.95
5.2.00.0050.0308.82
5.1.60.0070.0298.10
5.1.50.0070.0308.10
5.1.40.0130.0268.08
5.1.30.0080.0348.43
5.1.20.0070.0328.45
5.1.10.0050.0268.18
5.1.00.0050.0278.18
5.0.50.0050.0276.65
5.0.40.0050.0266.52
5.0.30.0040.0406.32
5.0.20.0060.0176.30
5.0.10.0020.0226.28
5.0.00.0060.0296.27
4.4.90.0020.0164.77
4.4.80.0020.0164.75
4.4.70.0030.0154.75
4.4.60.0050.0134.75
4.4.50.0020.0174.77
4.4.40.0020.0274.71
4.4.30.0050.0204.75
4.4.20.0040.0154.84
4.4.10.0030.0164.85
4.4.00.0090.0364.76
4.3.110.0110.0364.67
4.3.100.0050.0194.66
4.3.90.0040.0204.64
4.3.80.0010.0344.59
4.3.70.0040.0204.63
4.3.60.0060.0204.62
4.3.50.0060.0224.63
4.3.40.0050.0254.54
4.3.30.0020.0173.30
4.3.20.0020.0163.28
4.3.10.0020.0153.24
4.3.00.0000.0236.92

preferences:
40.61 ms | 401 KiB | 5 Q