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 ($that) { 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.0000.01416.63
8.3.50.0070.00721.98
8.3.40.0180.00018.54
8.3.30.0070.01019.23
8.3.20.0020.00520.30
8.3.10.0030.00523.71
8.3.00.0040.00419.38
8.2.180.0040.01118.38
8.2.170.0070.01422.96
8.2.160.0140.00020.52
8.2.150.0000.00924.18
8.2.140.0040.00424.66
8.2.130.0000.00726.16
8.2.120.0040.00422.16
8.2.110.0060.00322.21
8.2.100.0110.00017.84
8.2.90.0040.00419.09
8.2.80.0030.00517.97
8.2.70.0040.00417.75
8.2.60.0040.00418.04
8.2.50.0080.00018.07
8.2.40.0050.00319.89
8.2.30.0000.00718.05
8.2.20.0080.00017.64
8.2.10.0040.00418.05
8.2.00.0000.01117.64
8.1.280.0150.00625.92
8.1.270.0000.00823.79
8.1.260.0030.00526.35
8.1.250.0000.00728.09
8.1.240.0090.00023.74
8.1.230.0000.01019.14
8.1.220.0050.00317.74
8.1.210.0060.00318.77
8.1.200.0060.00317.35
8.1.190.0040.00417.53
8.1.180.0040.00418.89
8.1.170.0000.00818.55
8.1.160.0000.00722.03
8.1.150.0000.00918.66
8.1.140.0030.00617.37
8.1.130.0030.00317.72
8.1.120.0000.00817.50
8.1.110.0050.00317.43
8.1.100.0040.00817.43
8.1.90.0070.00017.46
8.1.80.0070.00017.38
8.1.70.0040.00417.44
8.1.60.0000.00917.61
8.1.50.0000.00917.54
8.1.40.0000.00917.57
8.1.30.0040.00417.65
8.1.20.0040.00417.66
8.1.10.0000.00717.57
8.1.00.0040.00417.56
8.0.300.0040.00420.75
8.0.290.0040.00417.16
8.0.280.0030.00318.49
8.0.270.0030.00317.30
8.0.260.0030.00317.30
8.0.250.0000.00716.94
8.0.240.0040.00416.94
8.0.230.0000.00716.95
8.0.220.0070.00016.87
8.0.210.0000.00716.86
8.0.200.0040.00416.92
8.0.190.0040.00417.07
8.0.180.0030.00316.84
8.0.170.0000.00816.89
8.0.160.0000.00716.86
8.0.150.0040.00416.82
8.0.140.0050.00316.92
8.0.130.0000.00613.41
8.0.120.0000.00716.94
8.0.110.0020.00516.95
8.0.100.0000.00716.84
8.0.90.0040.00416.75
8.0.80.0040.01416.90
8.0.70.0020.00517.05
8.0.60.0040.00417.02
8.0.50.0040.00416.89
8.0.30.0110.00917.23
8.0.20.0100.01217.40
8.0.10.0040.00416.95
8.0.00.0070.01017.06
7.4.330.0050.00015.10
7.4.320.0000.00616.44
7.4.300.0000.00616.55
7.4.290.0000.00816.51
7.4.280.0000.00716.62
7.4.270.0070.00016.52
7.4.260.0040.00416.68
7.4.250.0040.00416.47
7.4.240.0000.00816.56
7.4.230.0040.00416.64
7.4.220.0040.01416.49
7.4.210.0090.00716.56
7.4.200.0000.00716.42
7.4.190.0030.00316.53
7.4.160.0050.01116.43
7.4.150.0090.00917.40
7.4.140.0140.00717.86
7.4.130.0080.00916.52
7.4.120.0110.00616.61
7.4.110.0170.00016.54
7.4.100.0150.00916.70
7.4.90.0120.00616.67
7.4.80.0140.00519.39
7.4.70.0060.01116.49
7.4.60.0070.01016.48
7.4.50.0040.00416.32
7.4.40.0090.00622.77
7.4.30.0120.00616.68
7.4.10.0110.00014.91
7.4.00.0060.01115.08
7.3.330.0000.00613.20
7.3.320.0000.00613.15
7.3.310.0070.00016.39
7.3.300.0000.00916.37
7.3.290.0050.01016.33
7.3.280.0070.00816.33
7.3.270.0150.00317.40
7.3.260.0090.00816.53
7.3.250.0090.00816.46
7.3.240.0110.00716.46
7.3.230.0030.01316.54
7.3.210.0110.00816.52
7.3.200.0090.01119.39
7.3.190.0030.01416.43
7.3.180.0100.00616.50
7.3.170.0040.01116.59
7.3.160.0070.01016.39
7.3.130.0100.00715.02
7.3.120.0080.00914.85
7.3.110.0090.01014.82
7.3.100.0060.01014.71
7.3.90.0070.00414.88
7.3.80.0050.00814.87
7.3.70.0080.00714.81
7.3.60.0090.00514.76
7.3.50.0070.00414.78
7.3.40.0030.01014.75
7.3.30.0070.00614.82
7.3.20.0070.00716.72
7.3.10.0060.00616.63
7.3.00.0040.00716.66
7.2.330.0090.00916.72
7.2.320.0080.00816.40
7.2.310.0070.01016.77
7.2.300.0000.01716.71
7.2.290.0180.00016.75
7.2.260.0030.01315.20
7.2.250.0080.01015.14
7.2.240.0080.00815.14
7.2.230.0070.00815.16
7.2.220.0050.00615.23
7.2.210.0060.00615.16
7.2.200.0050.00915.17
7.2.190.0070.00615.09
7.2.180.0070.00515.12
7.2.170.0060.00915.01
7.2.160.0030.00715.17
7.2.150.0000.01416.86
7.2.140.0070.01016.78
7.2.130.0090.00316.96
7.2.120.0030.00616.96
7.2.110.0050.00516.93
7.2.100.0000.01816.93
7.2.90.0040.01117.14
7.2.80.0090.00017.02
7.2.70.0030.01017.09
7.2.60.0030.01117.09
7.2.50.0000.00916.89
7.2.40.0060.00916.98
7.2.30.0030.01316.65
7.2.20.0040.00416.66
7.2.10.0030.01016.92
7.2.00.0110.00318.29
7.1.330.0100.00315.80
7.1.320.0030.00715.63
7.1.310.0070.00615.78
7.1.300.0080.00615.89
7.1.290.0080.00515.74
7.1.280.0060.00915.78
7.1.270.0080.00715.89
7.1.260.0060.00915.74
7.1.250.0000.01115.61
7.1.240.0070.00715.80
7.1.230.0040.00415.45
7.1.220.0030.00515.64
7.1.210.0030.00515.67
7.1.200.0070.00715.48
7.1.190.0100.00315.68
7.1.180.0090.00315.92
7.1.170.0040.00415.55
7.1.160.0040.00415.90
7.1.150.0050.00315.84
7.1.140.0070.00715.57
7.1.130.0030.01015.94
7.1.120.0000.01015.68
7.1.110.0040.00415.88
7.1.100.0030.01116.86
7.1.90.0040.01215.52
7.1.80.0000.01415.61
7.1.70.0050.00516.33
7.1.60.0070.00917.48
7.1.50.0010.01516.39
7.1.40.0040.00415.83
7.1.30.0040.00415.64
7.1.20.0070.00715.50
7.1.10.0060.00615.67
7.1.00.0070.04019.07
7.0.330.0070.00715.37
7.0.320.0070.00415.55
7.0.310.0040.00715.58
7.0.300.0070.00715.24
7.0.290.0000.00815.37
7.0.280.0090.00315.40
7.0.270.0000.01115.27
7.0.260.0100.00015.37
7.0.250.0000.01115.45
7.0.240.0030.01015.38
7.0.230.0070.00415.45
7.0.220.0040.00715.53
7.0.210.0060.00615.28
7.0.200.0060.00316.15
7.0.190.0070.00415.43
7.0.180.0000.01215.45
7.0.170.0090.00315.13
7.0.160.0060.00615.43
7.0.150.0050.00315.27
7.0.140.0020.04218.80
7.0.130.0050.00515.34
7.0.120.0030.01015.51
7.0.110.0040.00815.43
7.0.100.0090.00015.15
7.0.90.0060.00315.42
7.0.80.0080.00415.36
7.0.70.0030.00515.46
7.0.60.0050.04317.61
7.0.50.0060.02716.69
7.0.40.0020.02816.68
7.0.30.0170.02816.78
7.0.20.0130.04516.83
7.0.10.0020.03416.83
7.0.00.0030.02716.86
5.6.400.0030.01014.27
5.6.390.0060.00914.20
5.6.380.0070.00314.27
5.6.370.0030.00614.26
5.6.360.0030.01014.58
5.6.350.0000.01114.54
5.6.340.0060.00914.24
5.6.330.0070.00714.19
5.6.320.0030.00914.54
5.6.310.0110.00314.39
5.6.300.0030.00914.37
5.6.290.0070.00314.16
5.6.280.0030.04217.71
5.6.270.0090.00614.14
5.6.260.0070.00714.27
5.6.250.0070.00414.11
5.6.240.0070.00714.23
5.6.230.0100.00314.33
5.6.220.0060.00614.24
5.6.210.0030.03917.37
5.6.200.0050.04416.23
5.6.190.0040.04017.39
5.6.180.0180.04217.41
5.6.170.0150.04417.30
5.6.160.0100.04117.41
5.6.150.0050.03716.25
5.6.140.0050.02916.33
5.6.130.0050.02516.12
5.6.120.0050.05017.68
5.6.110.0100.04817.83
5.6.100.0090.03717.55
5.6.90.0080.03817.58
5.6.80.0100.04317.42
5.6.70.2190.02117.35
5.6.60.0030.00914.29
5.6.50.0080.00814.02
5.6.40.0030.01014.50
5.6.30.0030.01014.43
5.6.20.0070.00314.39
5.6.10.0030.01014.25
5.6.00.0030.01014.02
5.5.380.0000.01114.32
5.5.370.0070.01014.24
5.5.360.0110.00314.34
5.5.350.0110.04317.22
5.5.340.0060.04516.00
5.5.330.0040.02617.41
5.5.320.0080.03017.17
5.5.310.0180.04317.30
5.5.300.0090.02816.22
5.5.290.0110.04016.07
5.5.280.0080.03117.56
5.5.270.0080.03317.50
5.5.260.0020.02717.76
5.5.250.0040.05117.45
5.5.240.1210.02317.34
5.5.230.0060.00614.27
5.5.220.0030.01314.31
5.5.210.0000.01514.29
5.5.200.0060.00614.30
5.5.190.0060.00614.50
5.5.180.0030.00914.24
5.5.170.0000.01614.11
5.5.160.0000.01214.09
5.5.150.0110.00814.36
5.5.140.0030.01414.14
5.5.130.0060.01214.34
5.5.120.0070.00714.12
5.5.110.0080.00414.32
5.5.100.0040.00414.44
5.5.90.0100.00713.95
5.5.80.0060.00614.36
5.5.70.0030.00914.31
5.5.60.0030.00914.23
5.5.50.0000.01214.15
5.5.40.0080.00414.06
5.5.30.0060.00914.25
5.5.20.0110.00714.27
5.5.10.0090.00014.15
5.5.00.0060.00613.94
5.4.450.0390.02916.20
5.4.440.0630.03316.13
5.4.430.0440.02516.09
5.4.420.0550.03516.06
5.4.410.0380.03016.04
5.4.400.0350.03115.95
5.4.390.0070.03016.00
5.4.380.0230.04115.67
5.4.370.0140.03015.77
5.4.360.0120.03215.62
5.4.350.0260.03615.73
5.4.340.0230.03615.68
5.4.330.0000.00812.75
5.4.320.0050.02212.63
5.4.310.0020.02612.63
5.4.300.0040.02412.63
5.4.290.0070.02512.62
5.4.280.0060.02512.57
5.4.270.0110.03612.57
5.4.260.0060.03712.57
5.4.250.0060.03012.57
5.4.240.0100.03012.57
5.4.230.0080.05212.56
5.4.220.0040.03112.57
5.4.210.0060.03012.57
5.4.200.0080.03312.57
5.4.190.0060.04012.56
5.4.180.0080.04412.57
5.4.170.0080.02912.57
5.4.160.0060.02612.57
5.4.150.0090.03012.56
5.4.140.0060.02312.41
5.4.130.0070.03312.40
5.4.120.0100.03312.38
5.4.110.0060.02512.38
5.4.100.0060.02412.38
5.4.90.0060.02812.38
5.4.80.0070.04012.38
5.4.70.0070.03312.38
5.4.60.0060.03512.38
5.4.50.0080.02912.38
5.4.40.0040.02812.37
5.4.30.0060.02912.37
5.4.20.0060.03112.37
5.4.10.0080.03312.37
5.4.00.0090.04312.12
5.3.290.0090.02112.78
5.3.280.0090.03612.73
5.3.270.0090.02712.74
5.3.260.0070.03312.74
5.3.250.0090.02412.74
5.3.240.0100.03312.73
5.3.230.0100.02912.73
5.3.220.0110.02512.71
5.3.210.0080.02412.71
5.3.200.0070.02912.71
5.3.190.0080.03212.71
5.3.180.0160.04612.71
5.3.170.0130.03612.71
5.3.160.0110.04912.71
5.3.150.0100.04712.71
5.3.140.0100.04612.71
5.3.130.0160.04312.71
5.3.120.0100.03212.70
5.3.110.0110.03212.71
5.3.100.0080.02312.44
5.3.90.0100.02512.43
5.3.80.0070.02712.43
5.3.70.0080.02712.43
5.3.60.0080.02712.42
5.3.50.0100.02312.40
5.3.40.0100.03012.39
5.3.30.0090.02612.38
5.3.20.0120.04312.27
5.3.10.0130.04112.25
5.3.00.0130.05112.24
5.2.170.0160.0569.22
5.2.160.0120.0679.23
5.2.150.0140.0749.23
5.2.140.0210.0569.22
5.2.130.0110.0739.18
5.2.120.0110.0509.18
5.2.110.0170.0599.19
5.2.100.0200.0789.19
5.2.90.0140.0709.19
5.2.80.0130.0599.18
5.2.70.0180.0609.18
5.2.60.0170.0799.13
5.2.50.0060.0449.11
5.2.40.0160.0819.07
5.2.30.0160.0939.06
5.2.20.0120.0589.04
5.2.10.0150.0448.95
5.2.00.0140.0808.81
5.1.60.0090.0638.09
5.1.50.0060.0468.09
5.1.40.0070.0268.08
5.1.30.0060.0298.42
5.1.20.0090.0278.45
5.1.10.0050.0368.17
5.1.00.0040.0308.17
5.0.50.0060.0246.65
5.0.40.0110.0366.51
5.0.30.0060.0376.32
5.0.20.0060.0376.29
5.0.10.0070.0366.27
5.0.00.0060.0346.26
4.4.90.0030.0184.77
4.4.80.0030.0174.75
4.4.70.0020.0194.75
4.4.60.0030.0194.75
4.4.50.0020.0184.77
4.4.40.0060.0264.71
4.4.30.0060.0164.76
4.4.20.0040.0184.85
4.4.10.0060.0164.85
4.4.00.0040.0344.75
4.3.110.0060.0174.67
4.3.100.0030.0164.67
4.3.90.0020.0174.64
4.3.80.0020.0284.58
4.3.70.0030.0174.63
4.3.60.0030.0154.63
4.3.50.0020.0184.63
4.3.40.0040.0254.53
4.3.30.0040.0153.30
4.3.20.0020.0183.28
4.3.10.0020.0183.24
4.3.00.0270.03310.54

preferences:
68.92 ms | 400 KiB | 5 Q