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) { // Closure::bind() actually creates a new instance of the closure $sweetsThief = Closure::bind($this->sweetsThief(), null, $that); var_dump($this->sweetsThief($that)); } public function sweetsThief($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.70.0090.00616.50
8.3.60.0100.01016.63
8.3.50.0140.00321.96
8.3.40.0070.01118.84
8.3.30.0070.00719.14
8.3.20.0110.00320.34
8.3.10.0080.00823.65
8.3.00.0080.00019.13
8.2.180.0090.00918.43
8.2.170.0070.01722.96
8.2.160.0100.00320.39
8.2.150.0040.00424.18
8.2.140.0000.00724.66
8.2.130.0040.00426.16
8.2.120.0040.00422.25
8.2.110.0060.00320.39
8.2.100.0080.00417.72
8.2.90.0070.00019.23
8.2.80.0040.00417.97
8.2.70.0100.00017.63
8.2.60.0050.00317.80
8.2.50.0060.00318.07
8.2.40.0000.00819.95
8.2.30.0040.00418.13
8.2.20.0000.00817.62
8.2.10.0070.00018.00
8.2.00.0030.00717.73
8.1.280.0130.00625.92
8.1.270.0090.00323.95
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0000.00822.11
8.1.230.0080.00417.42
8.1.220.0040.00417.74
8.1.210.0050.00318.77
8.1.200.0060.00317.47
8.1.190.0040.00417.54
8.1.180.0090.00318.10
8.1.170.0080.00318.69
8.1.160.0060.00322.05
8.1.150.0090.00318.60
8.1.140.0040.00417.55
8.1.130.0030.00317.74
8.1.120.0000.00817.58
8.1.110.0040.00417.40
8.1.100.0070.00317.46
8.1.90.0040.00417.56
8.1.80.0040.00417.39
8.1.70.0030.00317.50
8.1.60.0000.00917.61
8.1.50.0030.00517.51
8.1.40.0080.00017.54
8.1.30.0040.00417.58
8.1.20.0050.00317.65
8.1.10.0000.00817.59
8.1.00.0040.00417.48
8.0.300.0040.00418.77
8.0.290.0040.00417.04
8.0.280.0030.00318.49
8.0.270.0030.00317.30
8.0.260.0000.00717.27
8.0.250.0030.00316.96
8.0.240.0080.00017.04
8.0.230.0070.00016.86
8.0.220.0000.00616.89
8.0.210.0080.00016.94
8.0.200.0000.00617.09
8.0.190.0040.00416.96
8.0.180.0040.00817.00
8.0.170.0060.00316.87
8.0.160.0020.00516.99
8.0.150.0020.00516.86
8.0.140.0070.00016.91
8.0.130.0000.00613.40
8.0.120.0000.00816.96
8.0.110.0040.00417.00
8.0.100.0040.00417.02
8.0.90.0040.00416.92
8.0.80.0040.01116.94
8.0.70.0000.00716.84
8.0.60.0000.00716.81
8.0.50.0050.00216.95
8.0.30.0110.00917.22
8.0.20.0050.01417.40
8.0.10.0000.00717.10
8.0.00.0100.01016.62
7.4.330.0000.00515.00
7.4.320.0000.00716.54
7.4.300.0030.00316.61
7.4.290.0000.00716.63
7.4.280.0030.00316.53
7.4.270.0070.00016.55
7.4.260.0030.00316.59
7.4.250.0080.00016.44
7.4.240.0040.00316.59
7.4.230.0070.00016.52
7.4.220.0090.00916.57
7.4.210.0070.00916.62
7.4.200.0030.00316.29
7.4.190.0070.00016.63
7.4.160.0070.01016.52
7.4.150.0100.00717.40
7.4.140.0090.00817.86
7.4.130.0070.00916.50
7.4.120.0080.00916.46
7.4.110.0090.00816.70
7.4.100.0070.01116.62
7.4.90.0060.01216.51
7.4.80.0090.01219.39
7.4.70.0070.01416.60
7.4.60.0120.00616.49
7.4.50.0030.00616.38
7.4.40.0040.00722.77
7.4.30.0100.00616.78
7.4.00.0000.01714.98
7.3.330.0040.00213.12
7.3.320.0030.00313.20
7.3.310.0030.00316.34
7.3.300.0000.00716.34
7.3.290.0070.01116.36
7.3.280.0140.00416.38
7.3.270.0130.00617.40
7.3.260.0110.00616.60
7.3.250.0090.00816.33
7.3.240.0110.00616.53
7.3.230.0070.01016.39
7.3.210.0100.00916.55
7.3.200.0100.01119.39
7.3.190.0060.01516.54
7.3.180.0060.00916.53
7.3.170.0030.01416.43
7.3.160.0030.01316.48
7.3.120.0050.01114.89
7.3.110.0120.00614.88
7.3.100.0040.01114.89
7.3.90.0030.00614.96
7.3.80.0030.00714.52
7.3.70.0050.00514.77
7.3.60.0110.00414.78
7.3.50.0070.00414.75
7.3.40.0120.00014.89
7.3.30.0030.00614.57
7.3.20.0120.00016.71
7.3.10.0050.00816.45
7.3.00.0030.00916.50
7.2.330.0080.00816.36
7.2.320.0060.01216.70
7.2.310.0100.01016.60
7.2.300.0100.01316.68
7.2.290.0060.01016.58
7.2.250.0110.00714.88
7.2.240.0080.00815.02
7.2.230.0120.00914.86
7.2.220.0060.00614.94
7.2.210.0090.00615.09
7.2.200.0080.00314.95
7.2.190.0030.00615.13
7.2.180.0100.00315.02
7.2.170.0120.00414.91
7.2.130.0140.00016.64
7.2.120.0090.00316.57
7.2.110.0070.00716.75
7.2.100.0130.01316.61
7.2.90.0070.00716.93
7.2.80.0160.00816.68
7.2.70.0000.01816.89
7.2.60.0090.00716.91
7.2.50.0290.00716.37
7.2.40.0220.00316.72
7.2.30.0160.00316.82
7.2.20.0030.00916.68
7.2.10.0040.01216.63
7.2.00.0060.01018.07
7.1.330.0080.00815.63
7.1.320.0080.00515.70
7.1.310.0060.00615.85
7.1.300.0030.00615.82
7.1.290.0040.01115.52
7.1.280.0030.00615.99
7.1.270.0000.01216.02
7.1.260.0120.00315.52
7.1.250.0030.00615.50
7.1.200.0030.00915.47
7.1.100.0000.01318.04
7.1.70.0040.00417.18
7.1.60.0100.01019.46
7.1.50.0070.00417.05
7.1.00.0000.08022.42
7.0.200.0110.00016.58
7.0.140.0030.06322.00
7.0.60.0070.07719.93
7.0.50.0000.09017.89
7.0.40.0030.05720.13
7.0.30.0530.04020.16
7.0.20.0330.06320.06
7.0.10.0130.05720.15
7.0.00.0070.07320.12
5.6.280.0070.07021.12
5.6.210.0130.08020.71
5.6.200.0100.07718.29
5.6.190.0100.05020.52
5.6.180.0170.04320.61
5.6.170.0430.07320.56
5.6.160.0100.07320.44
5.6.150.0070.07718.16
5.6.140.0070.08018.23
5.6.130.0230.06718.15
5.6.120.0070.05321.03
5.6.110.0000.04320.98
5.6.100.0070.06721.01
5.6.90.0070.04021.13
5.6.80.0170.07320.42
5.6.70.4430.03720.54
5.5.350.0270.07320.39
5.5.340.0070.03717.97
5.5.330.0000.05320.57
5.5.320.0300.04020.35
5.5.310.0200.04320.32
5.5.300.0070.07717.99
5.5.290.0000.09318.06
5.5.280.0070.08020.81
5.5.270.0070.05020.67
5.5.260.0030.08720.88
5.5.250.0070.08320.70
5.5.240.4230.03720.16
5.4.450.0770.05319.47
5.4.440.0730.06019.62
5.4.430.0530.07719.62
5.4.420.1030.05019.54
5.4.410.0730.04719.42
5.4.400.0900.05318.86
5.4.390.0970.05019.01
5.4.380.0300.05018.60
5.4.370.0330.06018.75
5.4.360.0330.05018.82
5.4.350.0300.06018.79
5.4.340.0270.06018.84
5.4.320.0080.03312.51
5.4.310.0110.04312.50
5.4.300.0070.04112.51
5.4.290.0090.06512.48
5.4.280.0110.06312.39
5.4.270.0120.07112.39
5.4.260.0120.05212.38
5.4.250.0150.08112.39
5.4.240.0370.09012.38
5.4.230.0100.12512.38
5.4.220.0130.08312.38
5.4.210.0130.09112.38
5.4.200.0100.08512.38
5.4.190.0210.08112.37
5.4.180.0160.07512.38
5.4.170.0140.10812.39
5.4.160.0160.06612.38
5.4.150.0160.05312.38
5.4.140.0130.07912.06
5.4.130.0220.08612.05
5.4.120.0110.05312.01
5.4.110.0100.05412.01
5.4.100.0170.09612.00
5.4.90.0150.06712.00
5.4.80.0180.09512.00
5.4.70.0040.09211.99
5.4.60.0120.05412.00
5.4.50.0250.11012.00
5.4.40.0140.06011.98
5.4.30.0230.11111.98
5.4.20.0120.07211.98
5.4.10.0120.15011.98
5.4.00.0210.10211.48
5.3.290.0090.04512.80
5.3.280.0140.07612.71
5.3.270.0170.06712.72
5.3.260.0110.05212.72
5.3.250.0100.06012.72
5.3.240.0080.05412.72
5.3.230.0100.04912.70
5.3.220.0090.05212.68
5.3.210.0120.08412.68
5.3.200.0070.06512.68
5.3.190.0180.06812.68
5.3.180.0130.07012.68
5.3.170.0150.08012.67
5.3.160.0260.09812.67
5.3.150.0120.05812.67
5.3.140.0090.04412.66
5.3.130.0080.04112.66
5.3.120.0150.06712.66
5.3.110.0100.08412.66
5.3.100.0080.06912.13
5.3.90.0070.06012.12
5.3.80.0160.06812.11
5.3.70.0170.09012.10
5.3.60.0120.08512.09
5.3.50.0100.08012.04
5.3.40.0120.06212.04
5.3.30.0150.06612.00
5.3.20.0150.05611.78
5.3.10.0120.06911.74
5.3.00.0140.07711.73
5.2.170.0100.0639.23
5.2.160.0070.0699.23
5.2.150.0100.0649.23
5.2.140.0070.0449.23
5.2.130.0130.0489.19
5.2.120.0070.0749.19
5.2.110.0200.1019.20
5.2.100.0150.0589.20
5.2.90.0090.0569.19
5.2.80.0060.0419.19
5.2.70.0110.0589.19
5.2.60.0100.0419.14
5.2.50.0050.0359.11
5.2.40.0060.0319.08
5.2.30.0080.0379.06
5.2.20.0090.0579.05
5.2.10.0180.0718.96
5.2.00.0170.0468.82
5.1.60.0120.0438.10
5.1.50.0060.0498.09
5.1.40.0150.0608.08
5.1.30.0120.0578.43
5.1.20.0130.0868.45
5.1.10.0070.0398.17
5.1.00.0070.0408.17
5.0.50.0070.0306.66
5.0.40.0210.0446.52
5.0.30.0110.1086.32
5.0.20.0090.0456.30
5.0.10.0090.0576.28
5.0.00.0080.0766.27
4.4.90.0100.0374.78
4.4.80.0070.0364.75
4.4.70.0030.0254.75
4.4.60.0050.0234.75
4.4.50.0040.0214.77
4.4.40.0030.0334.71
4.4.30.0080.0964.76
4.4.20.0060.0214.84
4.4.10.0120.0344.85
4.4.00.0050.0604.76
4.3.110.0150.0434.67
4.3.100.0050.0424.66
4.3.90.0070.0304.64
4.3.80.0090.0524.58
4.3.70.0130.0424.63
4.3.60.0040.0424.62
4.3.50.0080.0444.63
4.3.40.0050.0524.54
4.3.30.0070.0473.30
4.3.20.0020.0223.28
4.3.10.0020.0243.24
4.3.00.0370.02310.54

preferences:
42.77 ms | 401 KiB | 5 Q