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(), null, $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.0100.00616.88
8.3.50.0090.00922.04
8.3.40.0160.00418.68
8.3.30.0100.00719.04
8.3.20.0070.01020.35
8.3.10.0000.01123.53
8.3.00.0040.00419.38
8.2.180.0110.00418.38
8.2.170.0120.00622.96
8.2.160.0130.00720.27
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0070.00026.16
8.2.120.0000.00722.30
8.2.110.0040.00419.10
8.2.100.0100.00317.84
8.2.90.0060.00319.05
8.2.80.0000.00917.97
8.2.70.0000.00917.63
8.2.60.0060.00617.80
8.2.50.0060.00618.07
8.2.40.0050.00319.88
8.2.30.0050.00318.01
8.2.20.0040.00417.68
8.2.10.0020.00517.96
8.2.00.0070.00017.63
8.1.280.0110.00725.92
8.1.270.0060.00323.87
8.1.260.0000.00826.35
8.1.250.0000.00728.09
8.1.240.0040.00422.55
8.1.230.0060.00620.93
8.1.220.0030.00518.64
8.1.210.0040.00419.02
8.1.200.0030.00617.35
8.1.190.0040.00417.52
8.1.180.0030.00618.10
8.1.170.0030.00618.48
8.1.160.0000.00721.96
8.1.150.0030.00818.54
8.1.140.0000.00717.36
8.1.130.0030.00317.86
8.1.120.0040.00417.52
8.1.110.0050.00317.45
8.1.100.0000.00917.53
8.1.90.0040.00417.39
8.1.80.0000.00717.52
8.1.70.0050.00317.41
8.1.60.0030.00617.61
8.1.50.0030.00517.45
8.1.40.0000.00717.55
8.1.30.0000.00817.56
8.1.20.0040.00417.70
8.1.10.0050.00317.57
8.1.00.0070.00017.50
8.0.300.0030.00619.91
8.0.290.0000.00717.17
8.0.280.0000.00718.41
8.0.270.0040.00417.11
8.0.260.0030.00317.35
8.0.250.0000.00716.94
8.0.240.0080.00016.95
8.0.230.0030.00316.92
8.0.220.0000.00716.92
8.0.210.0000.00716.85
8.0.200.0000.00716.97
8.0.190.0060.00316.93
8.0.180.0100.00017.02
8.0.170.0000.00816.88
8.0.160.0000.00816.86
8.0.150.0000.00716.77
8.0.140.0040.00416.87
8.0.130.0030.00313.43
8.0.120.0050.00316.89
8.0.110.0040.00416.99
8.0.100.0040.00417.00
8.0.90.0000.00816.87
8.0.80.0100.00716.97
8.0.70.0050.00216.85
8.0.60.0030.00616.93
8.0.50.0030.00517.00
8.0.30.0080.01017.00
8.0.20.0090.01017.40
8.0.10.0000.00717.16
8.0.00.0090.01016.88
7.4.330.0000.00515.00
7.4.320.0030.00316.59
7.4.300.0030.00316.43
7.4.290.0030.00316.54
7.4.280.0040.00416.52
7.4.270.0000.00716.66
7.4.260.0070.00016.55
7.4.250.0050.00316.48
7.4.240.0010.00616.55
7.4.230.0030.00316.62
7.4.220.0000.02016.60
7.4.210.0080.00816.60
7.4.200.0030.00516.63
7.4.190.0000.00716.57
7.4.160.0100.00516.37
7.4.150.0080.01117.40
7.4.140.0110.00617.86
7.4.130.0040.01716.61
7.4.120.0100.00716.47
7.4.110.0030.01316.64
7.4.100.0080.01216.42
7.4.90.0140.00316.53
7.4.80.0150.00919.39
7.4.70.0070.01316.46
7.4.60.0070.01016.55
7.4.50.0030.00516.61
7.4.40.0060.00622.77
7.4.30.0080.00816.70
7.4.00.0120.00314.63
7.3.330.0040.00413.23
7.3.320.0000.00613.19
7.3.310.0030.00316.27
7.3.300.0040.00416.30
7.3.290.0050.00816.39
7.3.280.0070.00916.33
7.3.270.0080.00817.40
7.3.260.0130.01016.42
7.3.250.0090.00816.48
7.3.240.0070.01016.58
7.3.230.0000.01616.49
7.3.210.0070.01016.61
7.3.200.0110.00719.39
7.3.190.0070.01016.52
7.3.180.0060.00916.40
7.3.170.0100.01116.46
7.3.160.0030.01316.38
7.3.120.0070.00714.83
7.2.330.0090.01216.30
7.2.320.0110.00616.83
7.2.310.0100.01316.65
7.2.300.0000.02016.64
7.2.290.0160.00316.50
7.2.60.0030.01316.88
7.2.00.0040.00819.45
7.1.200.0090.00315.76
7.1.100.0080.00418.08
7.1.70.0080.00416.80
7.1.60.0100.00719.46
7.1.50.0090.01217.06
7.1.00.0100.06722.43
7.0.200.0000.00716.82
7.0.140.0030.07021.92
7.0.60.0100.08719.89
7.0.50.0030.04317.82
7.0.40.0070.08720.18
7.0.30.0500.06720.20
7.0.20.0130.04720.23
7.0.10.0200.03720.15
7.0.00.0130.05720.10
5.6.280.0070.06721.16
5.6.210.0030.05020.48
5.6.200.0070.08018.13
5.6.190.0100.08320.48
5.6.180.0270.04720.64
5.6.170.0200.06720.51
5.6.160.0130.07720.50
5.6.150.0000.05018.15
5.6.140.0100.04718.18
5.6.130.0000.04318.21
5.6.120.0070.05721.04
5.6.110.0170.07321.02
5.6.100.0100.08320.98
5.6.90.0130.07721.00
5.6.80.0100.07020.36
5.6.70.4600.03320.28
5.5.350.0030.03320.42
5.5.340.0030.04018.01
5.5.330.0030.05020.37
5.5.320.0230.04720.23
5.5.310.0300.04320.42
5.5.300.0070.04717.98
5.5.290.0070.08318.06
5.5.280.0030.05020.82
5.5.270.0070.08720.95
5.5.260.0130.08020.68
5.5.250.0070.04020.72
5.5.240.0300.06020.13
5.4.450.0700.05719.53
5.4.440.0770.06719.47
5.4.430.0670.05319.59
5.4.420.0930.04719.56
5.4.410.0730.05019.34
5.4.400.0700.05719.21
5.4.390.0070.07019.30
5.4.380.0300.05318.54
5.4.370.0330.04718.84
5.4.360.0270.06018.61
5.4.350.0300.05718.74
5.4.340.0130.06318.79
5.4.320.0080.04112.50
5.4.310.0080.03912.50
5.4.300.0050.04112.51
5.4.290.0050.05712.48
5.4.280.0050.04412.38
5.4.270.0070.03812.38
5.4.260.0080.03712.38
5.4.250.0060.05312.38
5.4.240.0120.04512.38
5.4.230.0070.03712.38
5.4.220.0050.03812.38
5.4.210.0050.03612.38
5.4.200.0070.03712.38
5.4.190.0060.03712.37
5.4.180.0060.04012.37
5.4.170.0070.03412.39
5.4.160.0040.04112.38
5.4.150.0100.04512.38
5.4.140.0050.04012.06
5.4.130.0070.03612.05
5.4.120.0040.04312.01
5.4.110.0100.03812.00
5.4.100.0080.03512.00
5.4.90.0040.04112.00
5.4.80.0040.03912.00
5.4.70.0060.04012.00
5.4.60.0070.03511.99
5.4.50.0060.03712.00
5.4.40.0070.03611.98
5.4.30.0070.03611.98
5.4.20.0050.04011.98
5.4.10.0110.03511.98
5.4.00.0100.04211.47
5.3.290.0070.04012.80
5.3.280.0050.04412.71
5.3.270.0080.04812.72
5.3.260.0070.03912.72
5.3.250.0080.03712.72
5.3.240.0090.04512.72
5.3.230.0090.04612.70
5.3.220.0100.03812.68
5.3.210.0040.04712.68
5.3.200.0080.04412.68
5.3.190.0030.04712.68
5.3.180.0100.03612.67
5.3.170.0040.04712.67
5.3.160.0070.03812.68
5.3.150.0060.04112.67
5.3.140.0050.04512.66
5.3.130.0110.04312.66
5.3.120.0040.04312.66
5.3.110.0060.04112.66
5.3.100.0090.03612.13
5.3.90.0080.03612.13
5.3.80.0080.03912.11
5.3.70.0100.04012.10
5.3.60.0090.03612.09
5.3.50.0040.04112.04
5.3.40.0040.04012.04
5.3.30.0080.04212.00
5.3.20.0050.04111.78
5.3.10.0050.03911.74
5.3.00.0060.03811.73
5.2.170.0060.0309.23
5.2.160.0030.0339.23
5.2.150.0080.0329.23
5.2.140.0070.0299.23
5.2.130.0090.0369.19
5.2.120.0050.0319.19
5.2.110.0080.0389.20
5.2.100.0100.0349.19
5.2.90.0050.0309.19
5.2.80.0050.0329.19
5.2.70.0060.0449.19
5.2.60.0070.0429.14
5.2.50.0050.0419.11
5.2.40.0050.0319.08
5.2.30.0070.0439.06
5.2.20.0090.0379.05
5.2.10.0060.0398.96
5.2.00.0050.0438.82
5.1.60.0060.0358.10
5.1.50.0020.0298.10
5.1.40.0050.0278.08
5.1.30.0070.0378.43
5.1.20.0020.0328.45
5.1.10.0070.0258.18
5.1.00.0070.0338.18
5.0.50.0040.0196.66
5.0.40.0050.0186.52
5.0.30.0020.0326.32
5.0.20.0020.0206.30
5.0.10.0030.0266.27
5.0.00.0040.0336.27
4.4.90.0020.0174.78
4.4.80.0030.0154.75
4.4.70.0030.0154.76
4.4.60.0040.0204.75
4.4.50.0060.0164.77
4.4.40.0010.0284.71
4.4.30.0070.0134.76
4.4.20.0050.0154.84
4.4.10.0020.0174.85
4.4.00.0030.0264.76
4.3.110.0030.0164.67
4.3.100.0030.0164.66
4.3.90.0020.0164.63
4.3.80.0040.0244.58
4.3.70.0060.0134.63
4.3.60.0050.0144.63
4.3.50.0030.0184.63
4.3.40.0020.0294.54
4.3.30.0030.0193.30
4.3.20.0030.0163.28
4.3.10.0030.0183.24
4.3.00.0130.03010.54

preferences:
41.23 ms | 401 KiB | 5 Q