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); } 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.0040.01118.56
8.3.60.0110.00416.63
8.3.50.0080.01121.98
8.3.40.0070.01018.83
8.3.30.0100.00319.22
8.3.20.0040.00420.38
8.3.10.0040.00423.62
8.3.00.0080.00019.23
8.2.180.0070.00718.54
8.2.170.0120.00322.96
8.2.160.0070.00720.20
8.2.150.0100.01024.18
8.2.140.0080.00024.66
8.2.130.0090.00626.16
8.2.120.0000.00722.25
8.2.110.0060.00322.30
8.2.100.0080.00320.57
8.2.90.0030.00619.21
8.2.80.0000.00817.97
8.2.70.0060.00617.38
8.2.60.0040.00417.80
8.2.50.0000.00818.07
8.2.40.0050.00319.94
8.2.30.0000.00718.06
8.2.20.0040.00417.68
8.2.10.0030.00518.13
8.2.00.0090.00317.77
8.1.280.0070.00725.92
8.1.270.0050.00324.66
8.1.260.0060.00326.35
8.1.250.0040.00428.09
8.1.240.0030.00623.98
8.1.230.0090.00319.10
8.1.220.0040.00417.74
8.1.210.0050.00318.77
8.1.200.0040.00417.35
8.1.190.0030.00617.51
8.1.180.0060.00318.10
8.1.170.0090.00018.63
8.1.160.0040.00422.03
8.1.150.0090.00018.70
8.1.140.0050.00217.47
8.1.130.0030.00317.78
8.1.120.0030.00517.36
8.1.110.0000.00717.53
8.1.100.0090.00017.47
8.1.90.0000.00717.38
8.1.80.0070.00017.48
8.1.70.0000.00717.35
8.1.60.0000.00717.62
8.1.50.0000.00817.56
8.1.40.0040.00417.55
8.1.30.0000.00817.48
8.1.20.0070.00317.67
8.1.10.0070.00017.58
8.1.00.0070.00017.51
8.0.300.0040.00419.61
8.0.290.0040.00417.15
8.0.280.0030.00318.49
8.0.270.0070.00017.27
8.0.260.0000.00617.21
8.0.250.0030.00316.93
8.0.240.0000.00816.95
8.0.230.0000.00817.03
8.0.220.0040.00417.00
8.0.210.0030.00316.86
8.0.200.0000.00717.04
8.0.190.0000.00817.05
8.0.180.0070.00016.91
8.0.170.0040.00416.91
8.0.160.0040.00417.01
8.0.150.0030.00316.96
8.0.140.0070.00016.95
8.0.130.0000.00613.41
8.0.120.0000.00716.83
8.0.110.0030.00517.04
8.0.100.0040.00416.88
8.0.90.0050.00316.92
8.0.80.0040.01516.99
8.0.70.0070.00016.81
8.0.60.0040.00416.93
8.0.50.0040.00416.87
8.0.30.0100.01117.09
8.0.20.0140.00917.40
8.0.10.0050.00317.16
8.0.00.0120.00816.80
7.4.330.0000.00515.00
7.4.320.0060.00016.63
7.4.300.0030.00316.60
7.4.290.0070.00016.50
7.4.280.0000.00816.65
7.4.270.0000.00716.53
7.4.260.0030.00316.59
7.4.250.0000.00816.47
7.4.240.0020.00516.45
7.4.230.0000.00716.71
7.4.220.0060.01216.66
7.4.210.0040.01016.54
7.4.200.0040.00416.68
7.4.190.0030.00316.52
7.4.160.0030.01316.29
7.4.150.0070.01017.40
7.4.140.0120.00617.86
7.4.130.0070.01116.66
7.4.120.0060.01116.50
7.4.110.0090.00916.59
7.4.100.0000.02016.53
7.4.90.0130.01016.60
7.4.80.0090.00919.39
7.4.70.0110.00716.48
7.4.60.0060.01016.71
7.4.50.0080.00016.50
7.4.40.0040.01522.77
7.4.30.0150.00316.77
7.4.00.0030.01014.75
7.3.330.0030.00313.36
7.3.320.0020.00213.17
7.3.310.0070.00016.37
7.3.300.0040.00416.25
7.3.290.0070.00716.40
7.3.280.0130.00316.34
7.3.270.0030.01517.40
7.3.260.0070.01116.32
7.3.250.0100.00816.42
7.3.240.0170.00316.36
7.3.230.0110.00716.39
7.3.210.0090.00916.43
7.3.200.0130.00719.39
7.3.190.0070.01916.45
7.3.180.0100.00616.36
7.3.170.0000.02016.47
7.3.160.0070.01016.45
7.3.120.0070.01014.69
7.3.00.0070.01016.62
7.2.330.0170.00016.75
7.2.320.0070.01116.80
7.2.310.0200.00016.72
7.2.300.0120.00416.69
7.2.290.0090.01516.78
7.2.130.0060.00616.89
7.2.120.0110.00416.78
7.2.110.0070.00716.79
7.2.100.0070.00717.00
7.2.90.0040.00716.95
7.2.80.0060.00316.63
7.2.70.0000.00916.80
7.2.60.0040.00717.01
7.2.50.0070.00316.68
7.2.40.0060.00917.04
7.2.30.0060.00616.93
7.2.20.0030.00616.88
7.2.10.0060.01016.89
7.2.00.0110.00318.26
7.1.250.0030.01416.01
7.1.240.0050.00815.64
7.1.230.0100.00615.70
7.1.220.0110.00215.79
7.1.210.0030.01015.58
7.1.200.0030.00515.90
7.1.190.0100.00315.60
7.1.180.0070.00715.89
7.1.170.0030.01015.41
7.1.160.0070.00715.74
7.1.150.0040.00415.90
7.1.140.0060.00915.65
7.1.130.0100.00315.60
7.1.120.0110.00315.76
7.1.110.0070.00415.58
7.1.100.0050.00816.99
7.1.90.0090.00015.89
7.1.80.0110.00415.87
7.1.70.0040.00716.43
7.1.60.0060.01117.62
7.1.50.0100.00816.38
7.1.40.0040.00415.78
7.1.30.0080.00415.89
7.1.20.0000.01015.53
7.1.10.0080.00315.61
7.1.00.0090.03618.91
7.0.330.0000.01215.23
7.0.320.0000.01215.42
7.0.310.0080.00315.39
7.0.300.0050.00315.18
7.0.290.0090.00015.49
7.0.280.0030.00915.04
7.0.270.0070.00315.33
7.0.260.0000.00915.24
7.0.250.0090.00615.14
7.0.240.0070.00715.43
7.0.230.0070.00715.41
7.0.220.0040.00415.33
7.0.210.0040.00415.52
7.0.200.0050.00316.04
7.0.190.0070.00315.36
7.0.180.0040.00415.21
7.0.170.0050.00215.43
7.0.160.0000.01315.43
7.0.150.0040.00715.47
7.0.140.0050.04018.62
7.0.130.0000.01215.36
7.0.120.0090.00315.21
7.0.110.0060.00315.53
7.0.100.0130.04517.83
7.0.90.0220.04317.46
7.0.80.0030.04517.62
7.0.70.0170.03317.52
7.0.60.0080.03317.57
7.0.50.0120.03017.92
7.0.40.0030.04116.88
7.0.30.0080.04516.63
7.0.20.0130.04016.76
7.0.10.0050.04016.78
7.0.00.0040.03216.79
5.6.380.0060.00914.57
5.6.370.0070.00414.55
5.6.360.0000.00914.58
5.6.350.0040.00814.41
5.6.340.0090.00914.60
5.6.330.0060.01114.33
5.6.320.0040.00414.60
5.6.310.0060.00314.35
5.6.300.0030.00914.20
5.6.290.0040.01214.17
5.6.280.0050.04017.62
5.6.270.0040.00414.46
5.6.260.0040.00414.25
5.6.250.0070.04117.57
5.6.240.0080.02517.54
5.6.230.0050.03217.45
5.6.220.0090.04017.45
5.6.210.0070.04117.38
5.6.200.0110.04417.58
5.6.190.0130.02317.61
5.6.180.0000.03417.53
5.6.170.0070.04317.65
5.6.160.0020.05217.67
5.6.150.0070.04417.79
5.6.140.0080.03817.72
5.6.130.0060.03317.81
5.6.120.0060.04517.64
5.6.110.0050.02617.67
5.6.100.0080.03517.88
5.6.90.0100.03517.71
5.6.80.0030.04617.34
5.6.70.0070.03117.32
5.6.60.0080.04217.37
5.6.50.0060.03717.35
5.6.40.0050.02617.40
5.6.30.0070.04117.33
5.6.20.0060.02717.25
5.6.10.0040.02717.23
5.6.00.0050.03517.30
5.5.380.0080.03815.71
5.5.370.0100.04015.67
5.5.360.0000.03015.81
5.5.350.0020.04715.93
5.5.340.0020.04916.01
5.5.330.0070.04416.20
5.5.320.0080.03815.92
5.5.310.0060.04115.94
5.5.300.0070.02716.11
5.5.290.0050.04516.07
5.5.280.0000.04615.86
5.5.270.0020.03315.85
5.5.260.0030.02815.84
5.5.250.0020.04415.85
5.5.240.0050.02515.78
5.5.230.0140.01715.54
5.5.220.0030.02615.66
5.5.210.0090.03815.58
5.5.200.0080.03715.52
5.5.190.0070.04015.45
5.5.180.0060.03815.66
5.5.170.0040.00411.21
5.5.160.0030.04215.56
5.5.150.0060.03615.67
5.5.140.0030.04015.52
5.5.130.0030.04515.65
5.5.120.0030.02315.64
5.5.110.0090.02315.58
5.5.100.0080.04015.59
5.5.90.0050.04315.66
5.5.80.0050.04315.57
5.5.70.0050.03115.58
5.5.60.0060.03815.64
5.5.50.0040.03715.55
5.5.40.0020.04115.59
5.5.30.0050.03215.50
5.5.20.0050.04415.55
5.5.10.0020.04215.68
5.5.00.0050.04415.58
5.4.450.0080.03515.23
5.4.440.0110.03315.02
5.4.430.0000.04715.16
5.4.420.0050.03815.20
5.4.410.0090.03015.18
5.4.400.0090.03515.06
5.4.390.0020.04315.03
5.4.380.0030.03614.97
5.4.370.0050.04114.98
5.4.360.0050.02715.01
5.4.350.0060.03815.00
5.4.340.0080.03315.01
5.4.330.0020.00510.90
5.4.320.0050.04014.96
5.4.310.0100.03314.96
5.4.300.0080.03414.98
5.4.290.0060.04015.03
5.4.280.0050.03815.00
5.4.270.0050.04114.97
5.4.260.0030.02815.07
5.4.250.0030.04615.07
5.4.240.0030.03115.04
5.4.230.0070.03014.97
5.4.220.0030.04115.14
5.4.210.0020.04215.03
5.4.200.0050.04215.04
5.4.190.0080.03614.99
5.4.180.0020.04414.99
5.4.170.0050.04215.05
5.4.160.0070.02314.97
5.4.150.0090.03614.85
5.4.140.0030.04313.61
5.4.130.0030.03913.71
5.4.120.0090.03413.60
5.4.110.0030.03313.67
5.4.100.0060.02813.72
5.4.90.0120.02713.72
5.4.80.0090.03413.79
5.4.70.0020.02613.72
5.4.60.0070.03913.70
5.4.50.0040.02713.63
5.4.40.0100.02013.67
5.4.30.0050.03513.75
5.4.20.0030.04113.69
5.4.10.0070.04013.78
5.4.00.0070.03213.36
5.3.290.0080.03712.80
5.3.280.0090.03912.72
5.3.270.0050.03312.79
5.3.260.0070.03812.81
5.3.250.0030.03812.77
5.3.240.0040.03812.72
5.3.230.0050.03512.79
5.3.220.0030.03812.73
5.3.210.0060.04112.80
5.3.200.0110.03812.75
5.3.190.0070.03712.77
5.3.180.0070.03812.78
5.3.170.0070.03312.70
5.3.160.0030.03912.71
5.3.150.0050.03112.75
5.3.140.0050.03812.72
5.3.130.0020.04012.72
5.3.120.0000.02612.69
5.3.110.0050.03812.69
5.3.100.0030.04112.53
5.3.90.0030.02812.54
5.3.80.0030.04012.49
5.3.70.0060.02812.48
5.3.60.0080.02712.47
5.3.50.0000.03912.44
5.3.40.0040.03512.50
5.3.30.0070.03112.36
5.3.20.0020.03212.32
5.3.10.0060.03712.23
5.3.00.0050.04112.33
5.2.170.0070.03011.04
5.2.160.0030.03310.95
5.2.150.0100.02811.10
5.2.140.0000.02611.07
5.2.130.0040.03210.93
5.2.120.0070.01510.96
5.2.110.0070.01711.06
5.2.100.0050.03011.04
5.2.90.0000.03611.02
5.2.80.0020.02510.93
5.2.70.0040.03311.03
5.2.60.0060.02710.98
5.2.50.0030.03310.97
5.2.40.0030.03010.98
5.2.30.0030.03110.94
5.2.20.0050.02810.90
5.2.10.0040.03010.94
5.2.00.0020.02510.88
5.1.60.0050.01910.45
5.1.50.0040.02710.49
5.1.40.0070.02610.48
5.1.30.0020.03510.65
5.1.20.0020.01810.56
5.1.10.0050.02810.50
5.1.00.0070.02510.54
5.0.50.0030.0239.76
5.0.40.0030.0129.70
5.0.30.0040.0279.58
5.0.20.0030.0239.55
5.0.10.0030.0229.48
5.0.00.0050.0309.59
4.4.90.0000.0209.30
4.4.80.0050.0159.30
4.4.70.0060.0189.30
4.4.60.0000.0239.30
4.4.50.0050.0169.30
4.4.40.0030.0319.30
4.4.30.0000.0219.30
4.4.20.0060.0179.30
4.4.10.0000.0149.30
4.4.00.0000.0299.30
4.3.110.0030.0189.30
4.3.100.0020.0209.30
4.3.90.0060.0189.30
4.3.80.0000.0309.30
4.3.70.0020.0179.30
4.3.60.0020.0209.30
4.3.50.0030.0179.30
4.3.40.0000.0259.30
4.3.30.0040.0189.30
4.3.20.0030.0189.30
4.3.10.0000.0239.30
4.3.00.0020.0179.30

preferences:
45.7 ms | 401 KiB | 5 Q