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 $that; public function getAnswer($that) { /* $this->that = $that; $answerTime = Closure::bind($this->getPrivate(), null, $that); var_dump($answerTime); */ //$this->that = $that; $answerTime = Closure::bindTo(function () { return $this->answer; }, $that, $that); var_dump($answerTime); } public function getPrivate() { $that = $this->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.0030.01016.75
8.3.50.0000.01518.11
8.3.40.0130.00318.67
8.3.30.0040.01119.27
8.3.20.0070.00020.34
8.3.10.0000.00923.51
8.3.00.0050.00319.25
8.2.180.0140.00718.63
8.2.170.0040.01122.96
8.2.160.0110.00418.95
8.2.150.0100.01024.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0000.00722.21
8.2.110.0070.00322.27
8.2.100.0120.00017.91
8.2.90.0080.00019.18
8.2.80.0040.00417.97
8.2.70.0030.00717.59
8.2.60.0060.00317.80
8.2.50.0040.00418.07
8.2.40.0040.00419.76
8.2.30.0080.00018.07
8.2.20.0040.00417.59
8.2.10.0050.00218.09
8.2.00.0040.00717.70
8.1.270.0060.00323.79
8.1.260.0050.00326.35
8.1.250.0000.00828.09
8.1.240.0000.00923.66
8.1.230.0040.00819.08
8.1.220.0030.00617.74
8.1.210.0080.00018.77
8.1.200.0040.00417.35
8.1.190.0060.00317.52
8.1.180.0090.00019.11
8.1.170.0000.00818.48
8.1.160.0000.00821.94
8.1.150.0000.00918.66
8.1.140.0040.00417.39
8.1.130.0000.00717.86
8.1.120.0000.00717.45
8.1.110.0000.00817.39
8.1.100.0030.00717.39
8.1.90.0000.00717.39
8.1.80.0000.00717.41
8.1.70.0070.00017.39
8.1.60.0030.00617.52
8.1.50.0050.00317.45
8.1.40.0060.00317.59
8.1.30.0000.00817.61
8.1.20.0040.00417.55
8.1.10.0000.00817.49
8.1.00.0080.00017.43
8.0.300.0060.00320.86
8.0.290.0060.00317.18
8.0.280.0000.00718.41
8.0.270.0070.00017.13
8.0.260.0000.00717.27
8.0.250.0030.00316.99
8.0.240.0050.00216.97
8.0.230.0000.00717.05
8.0.220.0000.00716.93
8.0.210.0000.00716.93
8.0.200.0080.00016.98
8.0.190.0040.00417.02
8.0.180.0000.00816.89
8.0.170.0050.00316.79
8.0.160.0050.00316.89
8.0.150.0050.00316.76
8.0.140.0000.00816.98
8.0.130.0000.00813.41
8.0.120.0050.00216.93
8.0.110.0040.00417.04
8.0.100.0000.00816.86
8.0.90.0000.00717.05
8.0.80.0070.01717.01
8.0.70.0070.00016.93
8.0.60.0000.00716.81
8.0.50.0030.00516.85
8.0.30.0160.00517.08
8.0.20.0080.01117.40
8.0.10.0000.00717.22
8.0.00.0120.00416.83
7.4.330.0000.00515.10
7.4.320.0000.00616.44
7.4.300.0070.00016.55
7.4.290.0000.00716.43
7.4.280.0070.00016.56
7.4.270.0000.00716.53
7.4.260.0040.00416.60
7.4.250.0000.00816.63
7.4.240.0020.00516.61
7.4.230.0050.00316.71
7.4.220.0110.00716.53
7.4.210.0060.00816.50
7.4.200.0070.00016.55
7.4.190.0070.00016.71
7.4.160.0090.00616.31
7.4.150.0130.01317.40
7.4.140.0110.00717.86
7.4.130.0080.01116.70
7.4.120.0120.00516.50
7.4.110.0110.00716.29
7.4.100.0100.01016.45
7.4.90.0130.00316.64
7.4.80.0060.01319.39
7.4.70.0100.00716.51
7.4.60.0030.01416.53
7.4.50.0040.00416.30
7.4.40.0120.00322.77
7.4.30.0120.00616.81
7.4.00.0030.00914.93
7.3.330.0000.00713.15
7.3.320.0000.00513.29
7.3.310.0000.00716.41
7.3.300.0000.00816.34
7.3.290.0030.01216.32
7.3.280.0090.00816.38
7.3.270.0070.01017.40
7.3.260.0090.00916.39
7.3.250.0110.00716.53
7.3.240.0070.01116.54
7.3.230.0030.01416.53
7.3.210.0030.01316.44
7.3.200.0170.01219.39
7.3.190.0030.01916.58
7.3.180.0130.00316.45
7.3.170.0080.00816.45
7.3.160.0140.00316.44
7.3.120.0090.00614.91
7.2.330.0000.01616.65
7.2.320.0100.00716.37
7.2.310.0170.00016.57
7.2.300.0110.00816.41
7.2.290.0060.01016.66
7.2.110.0030.01316.66
7.2.60.0060.00616.76
7.2.00.0070.00719.36
7.1.200.0040.00415.88
7.1.100.0060.00617.71
7.1.70.0040.00417.18
7.1.60.0130.01319.46
7.1.50.0100.00716.95
7.1.00.0000.08022.45
7.0.200.0070.00016.49
7.0.140.0030.07022.00
7.0.60.0100.07720.02
7.0.50.0100.08017.88
7.0.40.0130.05720.15
7.0.30.0330.03720.08
7.0.20.0230.06720.21
7.0.10.0030.09320.33
7.0.00.0070.04320.07
5.6.280.0100.06720.86
5.6.210.0170.07020.70
5.6.200.0170.07718.18
5.6.190.0030.06320.48
5.6.180.0230.05720.52
5.6.170.0170.06020.55
5.6.160.0070.08320.57
5.6.150.0070.05318.13
5.6.140.0070.03718.15
5.6.130.0070.05018.16
5.6.120.0070.06020.96
5.6.110.0100.08021.02
5.6.100.0070.09021.16
5.6.90.0030.05321.03
5.6.80.0070.07320.38
5.5.350.0270.07320.46
5.5.340.0070.05318.09
5.5.330.0070.05020.30
5.5.320.0400.06720.24
5.5.310.0300.06320.24
5.5.300.0100.07017.93
5.5.290.0070.03717.93
5.5.280.0030.04320.89
5.5.270.0070.03720.83
5.5.260.0100.07320.78
5.5.250.0100.05020.63
5.5.240.3970.04320.37
5.4.450.0830.05319.47
5.4.440.0830.06019.54
5.4.430.0170.05319.18
5.4.420.0200.07019.54
5.4.410.0770.06319.42
5.4.400.0970.05719.16
5.4.390.0500.05319.34
5.4.380.0400.04718.58
5.4.370.0300.05318.46
5.4.360.0400.04318.77
5.4.350.0330.05018.60
5.4.340.0230.05718.77
5.4.320.0050.03712.52
5.4.310.0040.04812.52
5.4.300.0100.03512.51
5.4.290.0190.08812.49
5.4.280.0150.06612.39
5.4.270.0090.03912.39
5.4.260.0060.04412.39
5.4.250.0070.04412.39
5.4.240.0040.05812.39
5.4.230.0150.05312.38
5.4.220.0150.04112.38
5.4.210.0040.04412.39
5.4.200.0120.07712.38
5.4.190.0090.09012.38
5.4.180.0100.04312.38
5.4.170.0100.03812.39
5.4.160.0070.03812.39
5.4.150.0040.04012.38
5.4.140.0070.03912.07
5.4.130.0080.03612.05
5.4.120.0080.03612.01
5.4.110.0060.03812.00
5.4.100.0080.03912.01
5.4.90.0100.03712.01
5.4.80.0070.04012.01
5.4.70.0060.03812.00
5.4.60.0080.03712.00
5.4.50.0080.03912.00
5.4.40.0060.04011.99
5.4.30.0090.03611.98
5.4.20.0070.03911.99
5.4.10.0060.03811.99
5.4.00.0080.03911.48
5.3.290.0100.03512.80
5.3.280.0040.04712.71
5.3.270.0090.04412.72
5.3.260.0070.06212.72
5.3.250.0060.04212.72
5.3.240.0100.04412.72
5.3.230.0060.04212.71
5.3.220.0080.03912.68
5.3.210.0080.05812.68
5.3.200.0110.04412.68
5.3.190.0140.05812.68
5.3.180.0160.05512.68
5.3.170.0110.04812.66
5.3.160.0110.05012.67
5.3.150.0130.05412.68
5.3.140.0110.05812.66
5.3.130.0110.05312.66
5.3.120.0070.04312.66
5.3.110.0110.05312.66
5.3.100.0140.05312.13
5.3.90.0110.07112.12
5.3.80.0110.05012.11
5.3.70.0050.04212.11
5.3.60.0090.04912.09
5.3.50.0090.03812.04
5.3.40.0110.04912.04
5.3.30.0080.03812.00
5.3.20.0070.05011.79
5.3.10.0060.04211.74
5.3.00.0120.04611.73
5.2.170.0090.0419.23
5.2.160.0070.0459.22
5.2.150.0060.0459.23
5.2.140.0080.0479.22
5.2.130.0110.0449.18
5.2.120.0040.0429.18
5.2.110.0100.0489.19
5.2.100.0070.0399.19
5.2.90.0110.0459.19
5.2.80.0100.0399.19
5.2.70.0160.0769.18
5.2.60.0060.0419.13
5.2.50.0060.0419.11
5.2.40.0150.0639.07
5.2.30.0130.0379.05
5.2.20.0080.0429.04
5.2.10.0080.0488.95
5.2.00.0060.0448.82
5.1.60.0100.0358.09
5.1.50.0070.0338.09
5.1.40.0040.0378.07
5.1.30.0040.0408.43
5.1.20.0080.0378.45
5.1.10.0060.0388.17
5.1.00.0040.0398.17
5.0.50.0050.0286.66
5.0.40.0040.0296.50
5.0.30.0070.0406.32
5.0.20.0060.0266.28
5.0.10.0090.0476.27
5.0.00.0050.0356.26
4.4.90.0070.0274.78
4.4.80.0030.0174.75
4.4.70.0050.0234.76
4.4.60.0140.0424.76
4.4.50.0000.0194.77
4.4.40.0030.0284.71
4.4.30.0080.0174.76
4.4.20.0040.0234.84
4.4.10.0060.0314.84
4.4.00.0060.0304.76
4.3.110.0030.0234.66
4.3.100.0060.0204.66
4.3.90.0050.0204.63
4.3.80.0060.0304.59
4.3.70.0040.0214.63
4.3.60.0040.0214.63
4.3.50.0070.0174.63
4.3.40.0030.0324.53
4.3.30.0100.0313.30
4.3.20.0050.0243.28
4.3.10.0040.0253.24
4.3.00.0130.03710.54

preferences:
55.06 ms | 400 KiB | 5 Q