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::bind(function () { return $this; }, $that, $that); var_dump($answerTime->answer); } 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.0090.00616.88
8.3.50.0090.00621.91
8.3.40.0080.01218.42
8.3.30.0070.00719.21
8.3.20.0070.00020.35
8.3.10.0080.00023.39
8.3.00.0050.00319.26
8.2.180.0090.00616.36
8.2.170.0130.00322.96
8.2.160.0100.00320.38
8.2.150.0040.00724.18
8.2.140.0040.00424.66
8.2.130.0050.00326.16
8.2.120.0000.00822.26
8.2.110.0090.00022.13
8.2.100.0090.00317.91
8.2.90.0000.00719.13
8.2.80.0090.00017.97
8.2.70.0030.00617.63
8.2.60.0000.00817.93
8.2.50.0030.00518.07
8.2.40.0030.00519.95
8.2.30.0040.00418.13
8.2.20.0040.00417.82
8.2.10.0040.00418.08
8.2.00.0000.01117.82
8.1.280.0070.00725.92
8.1.270.0000.00823.97
8.1.260.0000.00826.35
8.1.250.0070.00028.09
8.1.240.0030.00623.92
8.1.230.0110.00019.16
8.1.220.0000.00817.74
8.1.210.0000.00918.77
8.1.200.0090.00017.23
8.1.190.0000.00817.53
8.1.180.0060.00318.10
8.1.170.0000.00818.57
8.1.160.0050.00321.97
8.1.150.0050.00518.66
8.1.140.0040.00417.46
8.1.130.0000.00717.91
8.1.120.0000.00717.38
8.1.110.0000.00817.43
8.1.100.0050.00517.44
8.1.90.0040.00417.46
8.1.80.0040.00417.38
8.1.70.0050.00217.36
8.1.60.0000.00817.48
8.1.50.0040.00417.49
8.1.40.0040.00417.55
8.1.30.0030.00517.65
8.1.20.0040.00417.69
8.1.10.0060.00317.60
8.1.00.0000.00817.54
8.0.300.0040.00420.73
8.0.290.0000.00817.05
8.0.280.0030.00318.32
8.0.270.0030.00317.17
8.0.260.0080.00017.18
8.0.250.0030.00316.91
8.0.240.0040.00416.97
8.0.230.0030.00316.90
8.0.220.0070.00016.89
8.0.210.0070.00016.95
8.0.200.0000.00716.98
8.0.190.0000.00817.05
8.0.180.0040.00416.95
8.0.170.0000.00817.01
8.0.160.0080.00016.87
8.0.150.0030.00516.89
8.0.140.0070.00016.91
8.0.130.0030.00313.43
8.0.120.0000.00816.89
8.0.110.0000.00716.96
8.0.100.0050.00217.04
8.0.90.0030.00516.87
8.0.80.0040.01817.00
8.0.70.0000.00816.77
8.0.60.0040.00417.00
8.0.50.0000.00716.77
8.0.30.0090.01217.01
8.0.20.0110.00817.40
8.0.10.0000.00816.94
8.0.00.0130.00516.89
7.4.330.0000.00515.00
7.4.320.0050.00216.62
7.4.300.0000.00616.52
7.4.290.0040.00416.43
7.4.280.0040.00416.43
7.4.270.0000.00716.59
7.4.260.0030.00316.55
7.4.250.0000.00816.49
7.4.240.0030.00316.63
7.4.230.0030.00316.63
7.4.220.0110.00716.48
7.4.210.0060.01016.57
7.4.200.0030.00316.47
7.4.190.0040.00416.68
7.4.160.0070.01116.64
7.4.150.0100.00717.40
7.4.140.0100.00817.86
7.4.130.0080.01016.58
7.4.120.0080.00916.58
7.4.110.0030.01416.46
7.4.100.0130.00616.44
7.4.90.0060.01216.58
7.4.80.0070.01319.39
7.4.70.0100.00616.44
7.4.60.0060.01316.64
7.4.50.0030.00516.52
7.4.40.0030.00722.77
7.4.30.0120.00916.73
7.4.00.0090.00614.76
7.3.330.0000.00613.43
7.3.320.0000.00513.18
7.3.310.0000.00716.38
7.3.300.0050.00216.29
7.3.290.0080.00816.37
7.3.280.0100.00716.35
7.3.270.0140.00317.40
7.3.260.0100.01416.63
7.3.250.0100.00816.49
7.3.240.0100.00616.61
7.3.230.0090.00916.39
7.3.210.0090.00916.56
7.3.200.0190.00019.39
7.3.190.0030.01316.38
7.3.180.0140.00316.35
7.3.170.0160.00016.50
7.3.160.0030.01316.60
7.3.120.0070.00314.95
7.3.10.0030.01016.45
7.3.00.0120.00816.29
7.2.330.0060.01016.46
7.2.320.0030.01316.36
7.2.310.0150.00316.72
7.2.300.0070.01016.67
7.2.290.0090.01516.78
7.2.130.0080.00516.59
7.2.120.0060.00616.63
7.2.110.0070.00716.69
7.2.100.0070.01116.88
7.2.90.0130.00316.61
7.2.80.0110.00416.65
7.2.70.0160.00016.66
7.2.60.0120.00316.70
7.2.50.0110.00616.39
7.2.40.0100.01016.41
7.2.30.0180.00316.55
7.2.20.0120.00316.60
7.2.10.0070.01116.50
7.2.00.0070.01018.10
7.1.250.0110.00415.34
7.1.200.0100.00015.63
7.1.100.0090.00618.12
7.1.70.0040.00416.86
7.1.60.0060.01619.46
7.1.50.0070.01316.76
7.1.00.0000.08022.33
7.0.200.0050.00316.77
7.0.140.0030.07322.00
7.0.60.0000.08720.03
7.0.50.0170.06717.86
7.0.40.0100.04320.18
7.0.30.0200.04720.21
7.0.20.0370.04020.07
7.0.10.0430.07020.12
7.0.00.0070.07020.09
5.6.280.0030.07320.82
5.6.210.0070.08020.74
5.6.200.0100.08318.24
5.6.190.0070.08720.52
5.6.180.0200.09020.55
5.6.170.0200.05720.50
5.6.160.0100.04020.57
5.6.150.0170.06718.16
5.6.140.0070.07718.18
5.6.130.0230.06318.18
5.6.120.0200.06721.01
5.6.110.0070.06321.04
5.6.100.0130.03321.15
5.6.90.0030.07320.98
5.6.80.0100.05020.39
5.6.70.0370.07020.52
5.5.350.0030.04020.34
5.5.340.0030.08717.96
5.5.330.0100.07020.42
5.5.320.0330.03720.31
5.5.310.0230.06320.35
5.5.300.0030.04018.08
5.5.290.0070.06718.01
5.5.280.0100.04720.87
5.5.270.0070.04320.86
5.5.260.0100.08020.86
5.5.250.0130.07320.60
5.5.240.0130.03020.25
5.4.450.0270.07319.39
5.4.440.0270.07719.47
5.4.430.0230.04319.27
5.4.420.0130.04719.46
5.4.410.0230.04719.36
5.4.400.0270.06319.25
5.4.390.0330.03719.22
5.4.380.0300.06018.95
5.4.370.0130.07719.23
5.4.360.0170.07719.20
5.4.350.0200.07319.22
5.4.340.0330.05019.07
5.4.320.0230.07719.23
5.4.310.0230.07318.88
5.4.300.0170.03719.19
5.4.290.0230.04319.20
5.4.280.0100.04319.21
5.4.270.0130.04019.13
5.4.260.0170.03718.87
5.4.250.0130.03719.23
5.4.240.0130.03718.98
5.4.230.0200.03719.15
5.4.220.0100.04319.18
5.4.210.0130.03719.21
5.4.200.0230.03719.07
5.4.190.0100.04019.15
5.4.180.0170.03719.23
5.4.170.0170.03719.18
5.4.160.0130.03718.85
5.4.150.0130.03719.11
5.4.140.0170.03316.56
5.4.130.0130.04016.43
5.4.120.0070.04016.40
5.4.110.0200.03016.63
5.4.100.0170.03016.60
5.4.90.0130.03316.59
5.4.80.0130.05316.59
5.4.70.0130.03316.58
5.4.60.0230.04316.51
5.4.50.0170.03316.34
5.4.40.0170.03716.56
5.4.30.0200.04316.43
5.4.20.0230.05016.16
5.4.10.0100.06316.53
5.4.00.0270.06315.96
5.3.290.0200.06314.76
5.3.280.0170.03314.53
5.3.270.0130.04714.62
5.3.260.0100.04014.62
5.3.250.0130.04314.53
5.3.240.0270.02714.70
5.3.230.0200.04314.51
5.3.220.0170.05014.59
5.3.210.0100.04014.50
5.3.200.0130.03714.50
5.3.190.0130.03714.66
5.3.180.0130.03714.57
5.3.170.0200.03014.80
5.3.160.0100.04014.50
5.3.150.0130.04714.54
5.3.140.0100.04014.57
5.3.130.0100.04014.71
5.3.120.0230.03714.56
5.3.110.0270.06714.56
5.3.100.0270.04714.09
5.3.90.0300.04314.15
5.3.80.0230.06713.93
5.3.70.0130.04713.96
5.3.60.0230.03713.94
5.3.50.0270.06713.91
5.3.40.0230.07014.13
5.3.30.0270.05713.82
5.3.20.0200.07013.61
5.3.10.0330.05713.64
5.3.00.0300.04013.56
5.2.170.0130.04312.34
5.2.160.0400.03012.34
5.2.150.0270.03312.34
5.2.140.0200.06012.34
5.2.130.0170.06312.34
5.2.120.0170.04712.34
5.2.110.0300.04012.34
5.2.100.0170.04012.34
5.2.90.0230.04312.34
5.2.80.0100.06712.34
5.2.70.0230.05312.34
5.2.60.0370.04012.34
5.2.50.0200.05312.34
5.2.40.0130.04712.34
5.2.30.0100.05312.34
5.2.20.0170.04712.34
5.2.10.0170.06012.34
5.2.00.0200.05312.34
5.1.60.0170.05312.34
5.1.50.0230.04312.34
5.1.40.0170.03712.34
5.1.30.0170.05312.34
5.1.20.0200.05012.34
5.1.10.0100.03712.34
5.1.00.0130.03012.34
5.0.50.0100.04012.34
5.0.40.0070.03712.34
5.0.30.0130.05012.34
5.0.20.0030.03712.34
5.0.10.0030.03012.34
5.0.00.0170.06012.34
4.4.90.0130.03012.34
4.4.80.0130.03012.34
4.4.70.0200.01712.34
4.4.60.0100.02012.34
4.4.50.0100.01712.34
4.4.40.0130.03312.34
4.4.30.0100.03312.34
4.4.20.0030.02712.34
4.4.10.0070.03712.34
4.4.00.0130.04312.34
4.3.110.0070.03312.34
4.3.100.0030.03712.34
4.3.90.0070.03012.34
4.3.80.0100.04312.34
4.3.70.0130.03012.34
4.3.60.0100.02712.34
4.3.50.0030.03012.34
4.3.40.0070.03312.34
4.3.30.0070.02312.34
4.3.20.0030.02012.34
4.3.10.0070.03312.34
4.3.00.0000.02712.34

preferences:
62.73 ms | 401 KiB | 5 Q