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->answer; }, $that, $that); var_dump($answerTime); var_dump($sweetsThief($that)); } 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.70.0080.00818.55
8.3.60.0070.00716.48
8.3.50.0140.00322.04
8.3.40.0140.00418.84
8.3.30.0110.00419.20
8.3.20.0040.00420.04
8.3.10.0040.00423.66
8.3.00.0050.00319.38
8.2.180.0150.00718.54
8.2.170.0130.00322.96
8.2.160.0070.00720.28
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0070.00026.16
8.2.120.0030.00621.13
8.2.110.0090.00022.25
8.2.100.0140.00517.64
8.2.90.0000.00819.34
8.2.80.0000.00817.97
8.2.70.0070.00417.63
8.2.60.0050.00317.92
8.2.50.0030.00618.07
8.2.40.0080.00019.89
8.2.30.0000.00718.08
8.2.20.0000.00717.79
8.2.10.0050.00318.01
8.2.00.0090.00317.77
8.1.280.0040.01225.92
8.1.270.0040.00423.87
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0080.00023.87
8.1.230.0110.00019.02
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0070.00317.35
8.1.190.0040.00417.42
8.1.180.0090.00018.10
8.1.170.0090.00018.51
8.1.160.0000.00722.00
8.1.150.0000.00818.54
8.1.140.0000.00717.44
8.1.130.0030.00317.86
8.1.120.0070.00017.50
8.1.110.0060.00317.47
8.1.100.0030.00617.52
8.1.90.0040.00417.39
8.1.80.0000.00717.39
8.1.70.0000.00717.43
8.1.60.0030.00617.57
8.1.50.0060.00317.55
8.1.40.0000.00817.62
8.1.30.0030.00517.52
8.1.20.0040.00417.68
8.1.10.0000.00817.56
8.1.00.0080.00017.43
8.0.300.0040.00418.77
8.0.290.0030.00317.18
8.0.280.0000.00718.36
8.0.270.0020.00517.22
8.0.260.0000.00618.31
8.0.250.0000.00816.99
8.0.240.0000.00816.95
8.0.230.0000.00716.94
8.0.220.0000.00716.82
8.0.210.0030.00316.81
8.0.200.0040.00416.99
8.0.190.0040.00417.03
8.0.180.0000.00716.91
8.0.170.0080.00017.07
8.0.160.0000.00816.93
8.0.150.0030.00416.95
8.0.140.0050.00316.94
8.0.130.0030.00313.34
8.0.120.0040.00416.91
8.0.110.0050.00316.89
8.0.100.0040.00416.98
8.0.90.0070.00017.03
8.0.80.0070.01416.96
8.0.70.0000.00716.77
8.0.60.0070.00017.02
8.0.50.0000.00817.05
8.0.30.0100.01317.01
8.0.20.0080.01217.40
8.0.10.0030.00516.94
8.0.00.0120.00616.80
7.4.330.0000.00515.00
7.4.320.0060.00016.46
7.4.300.0000.00716.68
7.4.290.0000.00716.44
7.4.280.0040.00416.49
7.4.270.0040.00416.66
7.4.260.0000.00716.53
7.4.250.0080.00016.48
7.4.240.0000.00716.44
7.4.230.0040.00416.47
7.4.220.0130.01016.57
7.4.210.0090.00716.57
7.4.200.0030.00316.35
7.4.190.0000.00716.50
7.4.160.0050.01016.79
7.4.150.0110.00817.40
7.4.140.0080.00917.86
7.4.130.0100.00816.59
7.4.120.0080.01016.56
7.4.110.0070.01416.65
7.4.100.0070.01116.46
7.4.90.0040.01416.57
7.4.80.0110.00719.39
7.4.70.0120.00816.62
7.4.60.0080.01116.48
7.4.50.0030.00316.55
7.4.40.0080.00522.77
7.4.30.0160.00616.58
7.4.00.0070.01015.00
7.3.330.0000.00513.30
7.3.320.0000.00613.23
7.3.310.0050.00216.19
7.3.300.0050.00216.23
7.3.290.0160.00316.35
7.3.280.0050.01116.33
7.3.270.0100.00717.40
7.3.260.0140.00416.54
7.3.250.0140.00416.56
7.3.240.0060.01016.37
7.3.230.0120.00616.48
7.3.210.0110.00916.40
7.3.200.0120.01419.39
7.3.190.0160.00316.59
7.3.180.0110.00616.39
7.3.170.0120.00416.54
7.3.160.0030.01316.52
7.3.120.0080.00414.67
7.2.330.0070.01016.61
7.2.320.0100.01116.72
7.2.310.0070.01016.75
7.2.300.0030.01416.66
7.2.290.0060.01516.69
7.2.60.0070.01016.88
7.2.00.0060.00619.16
7.1.200.0000.00915.91
7.1.100.0040.00817.73
7.1.70.0070.00317.05
7.1.60.0120.00919.46
7.1.50.0080.01216.98
7.1.00.0000.08022.43
7.0.200.0000.00716.78
7.0.140.0030.07022.12
7.0.60.0070.07020.01
7.0.50.0070.08017.89
7.0.40.0100.08320.02
7.0.30.0270.04020.06
7.0.20.0170.08320.09
7.0.10.0100.07720.09
7.0.00.0100.07020.18
5.6.210.0200.06720.68
5.6.200.0100.07018.16
5.6.190.0000.05020.39
5.6.180.0200.08020.77
5.6.170.0270.09020.47
5.6.160.0130.08020.39
5.6.150.0100.06718.21
5.6.140.0030.08718.18
5.6.130.0030.07318.24
5.6.120.0030.04320.95
5.6.110.0100.08721.03
5.6.100.0070.07321.02
5.6.90.0130.05721.02
5.6.80.0100.07720.55
5.6.70.4500.04720.52
5.5.350.0070.08320.35
5.5.340.0030.05718.05
5.5.330.0030.08320.28
5.5.320.0230.07720.27
5.5.310.0200.06320.34
5.5.300.0000.05318.04
5.5.290.0100.07017.96
5.5.280.0070.03720.99
5.5.270.0070.07720.77
5.5.260.0170.07020.84
5.5.250.0100.08020.81
5.5.240.0170.08020.28
5.4.450.0900.05319.45
5.4.440.0600.05719.18
5.4.430.0770.05019.15
5.4.420.0100.06019.66
5.4.410.0630.07319.34
5.4.400.0770.04319.26
5.4.390.0830.06719.14
5.4.380.0270.05718.79
5.4.370.0330.07718.63
5.4.360.0300.05318.81
5.4.350.0470.05018.80
5.4.340.0330.05018.59
5.4.320.0050.03712.52
5.4.310.0130.03912.51
5.4.300.0120.04112.52
5.4.290.0080.03712.49
5.4.280.0050.03712.39
5.4.270.0080.03812.39
5.4.260.0070.04012.39
5.4.250.0050.04112.39
5.4.240.0110.04812.39
5.4.230.0070.04912.38
5.4.220.0090.03612.38
5.4.210.0120.04412.39
5.4.200.0070.05212.38
5.4.190.0050.04012.38
5.4.180.0090.04712.38
5.4.170.0060.04112.39
5.4.160.0080.03712.39
5.4.150.0100.04012.38
5.4.140.0080.04012.07
5.4.130.0080.03712.06
5.4.120.0050.04212.01
5.4.110.0120.05112.01
5.4.100.0180.04012.00
5.4.90.0070.05812.01
5.4.80.0100.03712.01
5.4.70.0090.04812.01
5.4.60.0120.04412.01
5.4.50.0160.06112.00
5.4.40.0230.06211.99
5.4.30.0160.05911.99
5.4.20.0130.04911.99
5.4.10.0150.06211.99
5.4.00.0080.03911.48
5.3.290.0040.04112.80
5.3.280.0030.06012.71
5.3.270.0060.04512.72
5.3.260.0050.05012.72
5.3.250.0090.04512.72
5.3.240.0110.04412.72
5.3.230.0070.05512.70
5.3.220.0040.05612.68
5.3.210.0070.05012.68
5.3.200.0100.04612.68
5.3.190.0120.05312.68
5.3.180.0120.04812.68
5.3.170.0090.05812.67
5.3.160.0080.05812.68
5.3.150.0120.05712.67
5.3.140.0090.05412.66
5.3.130.0100.04012.66
5.3.120.0100.05312.65
5.3.110.0140.04412.66
5.3.100.0160.08012.13
5.3.90.0070.04212.11
5.3.80.0080.04112.11
5.3.70.0070.04512.11
5.3.60.0080.04012.09
5.3.50.0090.03712.04
5.3.40.0070.03812.04
5.3.30.0080.04312.00
5.3.20.0060.03611.79
5.3.10.0080.03711.75
5.3.00.0110.03711.73
5.2.170.0060.0339.22
5.2.160.0050.0319.23
5.2.150.0050.0329.22
5.2.140.0060.0409.22
5.2.130.0050.0329.18
5.2.120.0080.0339.18
5.2.110.0080.0419.19
5.2.100.0100.0509.19
5.2.90.0030.0409.19
5.2.80.0050.0429.18
5.2.70.0050.0439.18
5.2.60.0060.0419.14
5.2.50.0080.0399.10
5.2.40.0080.0409.08
5.2.30.0100.0479.06
5.2.20.0060.0299.04
5.2.10.0060.0288.95
5.2.00.0080.0398.82
5.1.60.0040.0368.09
5.1.50.0050.0248.09
5.1.40.0070.0348.07
5.1.30.0090.0448.42
5.1.20.0070.0378.45
5.1.10.0060.0438.16
5.1.00.0040.0398.17
5.0.50.0060.0276.66
5.0.40.0040.0286.50
5.0.30.0070.0396.32
5.0.20.0020.0296.29
5.0.10.0040.0286.27
5.0.00.0040.0406.26
4.4.90.0010.0244.77
4.4.80.0060.0344.75
4.4.70.0070.0244.75
4.4.60.0050.0214.75
4.4.50.0040.0224.77
4.4.40.0030.0364.71
4.4.30.0050.0274.76
4.4.20.0040.0214.84
4.4.10.0040.0204.84
4.4.00.0060.0294.76
4.3.110.0040.0204.67
4.3.100.0030.0174.66
4.3.90.0030.0164.63
4.3.80.0050.0334.59
4.3.70.0040.0174.63
4.3.60.0040.0204.63
4.3.50.0020.0184.62
4.3.40.0030.0324.54
4.3.30.0020.0263.30
4.3.20.0040.0233.28
4.3.10.0000.0293.24
4.3.00.0100.01013.17

preferences:
39.02 ms | 401 KiB | 5 Q