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 $answerTime = Closure::bind($this->getAnswer2($that), null, $that); var_dump($answerTime); } public function getAnswer2($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.0150.00018.55
8.3.50.0070.01222.06
8.3.40.0060.01318.92
8.3.30.0070.00719.04
8.3.20.0070.00020.07
8.3.10.0000.00823.48
8.3.00.0040.00419.25
8.2.180.0070.01418.54
8.2.170.0110.00422.96
8.2.160.0100.00320.52
8.2.150.0060.00324.18
8.2.140.0070.00024.66
8.2.130.0090.00626.16
8.2.120.0060.00322.09
8.2.110.0050.00522.01
8.2.100.0060.00617.72
8.2.90.0050.00318.09
8.2.80.0000.01017.97
8.2.70.0050.00317.50
8.2.60.0030.00617.93
8.2.50.0040.00418.10
8.2.40.0030.00619.95
8.2.30.0070.00017.89
8.2.20.0080.00017.71
8.2.10.0040.00418.08
8.2.00.0000.01017.75
8.1.280.0170.00325.92
8.1.270.0090.00023.91
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0030.00623.88
8.1.230.0050.01020.92
8.1.220.0080.00017.74
8.1.210.0000.00818.78
8.1.200.0040.00417.25
8.1.190.0040.00417.22
8.1.180.0060.00318.10
8.1.170.0000.00818.50
8.1.160.0040.00421.98
8.1.150.0070.00318.72
8.1.140.0040.00417.35
8.1.130.0000.00717.77
8.1.120.0040.00417.48
8.1.110.0040.00417.47
8.1.100.0000.00917.37
8.1.90.0070.00017.47
8.1.80.0040.00417.53
8.1.70.0040.00417.35
8.1.60.0000.00817.65
8.1.50.0030.00617.40
8.1.40.0000.00717.55
8.1.30.0030.00517.64
8.1.20.0040.00417.64
8.1.10.0060.00317.59
8.1.00.0000.00717.61
8.0.300.0040.00422.09
8.0.290.0040.00416.75
8.0.280.0000.00718.41
8.0.270.0050.00317.10
8.0.260.0060.00017.21
8.0.250.0030.00316.99
8.0.240.0000.00816.99
8.0.230.0070.00016.94
8.0.220.0030.00316.80
8.0.210.0000.00716.90
8.0.200.0060.00016.98
8.0.190.0090.00016.98
8.0.180.0000.01116.89
8.0.170.0040.00416.93
8.0.160.0000.00716.98
8.0.150.0040.00416.75
8.0.140.0030.00316.93
8.0.130.0080.00013.45
8.0.120.0080.00016.96
8.0.110.0040.00416.89
8.0.100.0040.00416.98
8.0.90.0050.00316.81
8.0.80.0070.01016.90
8.0.70.0050.00216.94
8.0.60.0070.00016.85
8.0.50.0040.00416.88
8.0.30.0130.00616.93
8.0.20.0140.00517.40
8.0.10.0040.00417.10
8.0.00.0090.01016.84
7.4.330.0050.00015.00
7.4.320.0030.00316.64
7.4.300.0030.00316.60
7.4.290.0030.00316.58
7.4.280.0080.00016.52
7.4.270.0000.00716.54
7.4.260.0000.00616.52
7.4.250.0070.00016.64
7.4.240.0020.00516.54
7.4.230.0050.00316.60
7.4.220.0060.01316.71
7.4.210.0070.00916.52
7.4.200.0040.00416.51
7.4.190.0050.00216.50
7.4.160.0060.00916.54
7.4.150.0070.01017.40
7.4.140.0100.00817.86
7.4.130.0050.01216.67
7.4.120.0070.01216.60
7.4.110.0100.00716.43
7.4.100.0110.00716.54
7.4.90.0100.00716.41
7.4.80.0100.01319.39
7.4.70.0070.01016.65
7.4.60.0130.00316.53
7.4.50.0030.00316.52
7.4.40.0040.01122.77
7.4.30.0160.00016.48
7.4.00.0070.01015.12
7.3.330.0000.00513.24
7.3.320.0030.00313.18
7.3.310.0000.00816.48
7.3.300.0080.00016.24
7.3.290.0130.00716.25
7.3.280.0120.00616.35
7.3.270.0130.00317.40
7.3.260.0060.01216.45
7.3.250.0140.00616.46
7.3.240.0140.00316.47
7.3.230.0100.00716.47
7.3.210.0100.00716.42
7.3.200.0140.00619.39
7.3.190.0070.01116.67
7.3.180.0160.00016.55
7.3.170.0130.00316.47
7.3.160.0090.01016.46
7.3.120.0100.00614.92
7.3.110.0040.01414.59
7.3.100.0060.00914.66
7.3.90.0060.00614.77
7.3.80.0000.01414.78
7.3.70.0040.01114.90
7.3.60.0040.01214.95
7.3.50.0030.00714.89
7.3.40.0000.01014.86
7.3.30.0070.00714.50
7.3.20.0070.01016.57
7.3.10.0050.00916.52
7.3.00.0060.00916.57
7.2.330.0090.00616.75
7.2.320.0160.00016.84
7.2.310.0100.00716.77
7.2.300.0060.00916.87
7.2.290.0100.00716.77
7.2.250.0070.01114.90
7.2.240.0030.01515.06
7.2.230.0090.00615.03
7.2.220.0080.00614.94
7.2.210.0000.01415.29
7.2.200.0030.01015.08
7.2.190.0110.00414.82
7.2.180.0030.00615.00
7.2.170.0100.00315.07
7.2.130.0040.01116.91
7.2.120.0100.00316.90
7.2.110.0030.00816.66
7.2.100.0030.01216.70
7.2.90.0030.01316.87
7.2.80.0090.00616.96
7.2.70.0060.00616.84
7.2.60.0070.00916.96
7.2.50.0030.01616.96
7.2.40.0000.01216.93
7.2.30.0100.00317.05
7.2.20.0040.01116.65
7.2.10.0090.00617.05
7.2.00.0050.00918.02
7.1.330.0090.00615.84
7.1.320.0060.00615.79
7.1.310.0030.01315.68
7.1.300.0100.00715.88
7.1.290.0080.00315.75
7.1.280.0070.00315.57
7.1.270.0030.01015.74
7.1.260.0070.00715.89
7.1.250.0030.01015.71
7.1.200.0040.00815.79
7.1.100.0080.00518.02
7.1.70.0060.00917.13
7.1.60.0110.01419.46
7.1.50.0120.00917.01
7.1.00.0100.06322.37
7.0.200.0040.00416.58
7.0.140.0070.06322.00
7.0.60.0070.07720.08
7.0.50.0030.07317.89
7.0.40.0170.08019.96
7.0.30.0330.07320.19
7.0.20.0270.08320.03
7.0.10.0070.07720.33
7.0.00.0100.05320.27
5.6.280.0070.07020.93
5.6.210.0100.07320.76
5.6.200.0200.07018.16
5.6.190.0070.04020.52
5.6.180.0400.07020.55
5.6.170.0130.04320.44
5.6.160.0100.08720.54
5.6.150.0130.03718.29
5.6.140.0070.07018.17
5.6.130.0030.06018.21
5.6.120.0100.04320.99
5.6.110.0100.07320.96
5.6.100.0070.05720.98
5.6.90.0130.05021.11
5.6.80.0030.08720.53
5.5.350.3500.03720.42
5.5.340.0100.04017.93
5.5.330.0070.08720.33
5.5.320.0430.06720.27
5.5.310.0200.07720.41
5.5.300.0000.06317.98
5.5.290.0030.04018.08
5.5.280.0200.07020.68
5.5.270.0000.04720.88
5.5.260.0030.08020.82
5.5.250.0030.05020.62
5.5.240.0000.07720.16
5.4.450.0470.03019.48
5.4.440.0230.05019.59
5.4.430.0230.04719.16
5.4.420.0200.04719.54
5.4.410.0430.03719.41
5.4.400.0800.03719.32
5.4.390.0200.04019.18
5.4.380.0470.05318.70
5.4.370.0370.05018.47
5.4.360.0270.05318.77
5.4.350.0370.04718.74
5.4.340.0330.05018.74
5.4.320.0060.03812.51
5.4.310.0080.04212.50
5.4.300.0050.03912.51
5.4.290.0120.06212.48
5.4.280.0100.06412.38
5.4.270.0170.07812.38
5.4.260.0120.06812.38
5.4.250.0100.06312.38
5.4.240.0100.06012.38
5.4.230.0110.06512.38
5.4.220.0060.06512.38
5.4.210.0110.05312.37
5.4.200.0090.05312.38
5.4.190.0090.05112.37
5.4.180.0150.06812.38
5.4.170.0190.06612.38
5.4.160.0070.05412.38
5.4.150.0040.06712.38
5.4.140.0080.06612.06
5.4.130.0080.05812.05
5.4.120.0100.05312.00
5.4.110.0100.03612.00
5.4.100.0110.03612.00
5.4.90.0090.04512.00
5.4.80.0130.07612.00
5.4.70.0110.05912.00
5.4.60.0070.05211.99
5.4.50.0110.05412.00
5.4.40.0130.05111.98
5.4.30.0120.06011.98
5.4.20.0140.06811.98
5.4.10.0070.05811.98
5.4.00.0120.08011.48
5.3.290.0110.03712.80
5.3.280.0100.06212.71
5.3.270.0080.06612.72
5.3.260.0120.07412.72
5.3.250.0170.08012.72
5.3.240.0130.09512.72
5.3.230.0110.05512.71
5.3.220.0100.04512.68
5.3.210.0150.05312.68
5.3.200.0090.03712.68
5.3.190.0090.04112.68
5.3.180.0070.04712.67
5.3.170.0090.04912.67
5.3.160.0060.05612.68
5.3.150.0120.06212.67
5.3.140.0050.04712.66
5.3.130.0090.04012.65
5.3.120.0110.04112.66
5.3.110.0100.04212.66
5.3.100.0120.04612.13
5.3.90.0110.05112.11
5.3.80.0120.04912.10
5.3.70.0070.05512.10
5.3.60.0070.05612.09
5.3.50.0080.05112.04
5.3.40.0050.05812.04
5.3.30.0150.06412.00
5.3.20.0150.05711.78
5.3.10.0060.05211.74
5.3.00.0120.04911.73
5.2.170.0050.0389.23
5.2.160.0130.0479.23
5.2.150.0050.0369.23
5.2.140.0030.0349.23
5.2.130.0100.0349.19
5.2.120.0070.0359.19
5.2.110.0050.0319.20
5.2.100.0060.0489.19
5.2.90.0020.0359.20
5.2.80.0010.0369.19
5.2.70.0050.0349.19
5.2.60.0170.0489.14
5.2.50.0160.0599.10
5.2.40.0070.0559.09
5.2.30.0120.0559.07
5.2.20.0080.0399.05
5.2.10.0170.0708.96
5.2.00.0070.0418.82
5.1.60.0110.0488.10
5.1.50.0100.1268.10
5.1.40.0080.0648.08
5.1.30.0040.0398.43
5.1.20.0040.0408.45
5.1.10.0080.0368.18
5.1.00.0050.0428.17
5.0.50.0050.0296.66
5.0.40.0060.0306.51
5.0.30.0090.0616.32
5.0.20.0030.0306.29
5.0.10.0050.0306.27
5.0.00.0030.0426.27
4.4.90.0120.0404.77
4.4.80.0080.0524.75
4.4.70.0040.0204.75
4.4.60.0010.0244.75
4.4.50.0040.0284.77
4.4.40.0070.0374.70
4.4.30.0040.0224.76
4.4.20.0060.0304.84
4.4.10.0040.0284.85
4.4.00.0080.0444.76
4.3.110.0080.0254.67
4.3.100.0080.0474.67
4.3.90.0090.0394.63
4.3.80.0080.0514.59
4.3.70.0080.0634.63
4.3.60.0060.0414.63
4.3.50.0060.0304.62
4.3.40.0110.0484.54
4.3.30.0050.0493.30
4.3.20.0100.0353.28
4.3.10.0070.0383.23
4.3.00.0030.01713.47

preferences:
46.53 ms | 401 KiB | 5 Q