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); $answerTime = Closure::bind([$this, 'getPrivate'], null, $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.40.0110.00718.96
8.3.30.0110.00419.02
8.3.20.0040.00420.30
8.3.10.0040.00423.51
8.3.00.0090.00019.38
8.2.170.0120.00322.96
8.2.160.0100.00320.39
8.2.150.0060.01224.18
8.2.140.0060.00324.66
8.2.130.0100.00726.16
8.2.120.0030.00522.25
8.2.110.0030.00722.25
8.2.100.0040.00817.95
8.2.90.0040.00418.03
8.2.80.0040.00417.97
8.2.70.0040.00817.50
8.2.60.0040.00417.93
8.2.50.0080.00018.07
8.2.40.0030.00519.65
8.2.30.0000.00718.09
8.2.20.0070.00017.87
8.2.10.0070.00017.96
8.2.00.0070.00417.89
8.1.270.0040.00423.77
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0030.00622.59
8.1.230.0040.00820.82
8.1.220.0040.00417.78
8.1.210.0050.00518.88
8.1.200.0060.00317.35
8.1.190.0050.00317.53
8.1.180.0050.00518.10
8.1.170.0030.00618.50
8.1.160.0040.00422.06
8.1.150.0110.00018.59
8.1.140.0050.00217.42
8.1.130.0030.00317.78
8.1.120.0070.00017.46
8.1.110.0050.00317.51
8.1.100.0030.00617.42
8.1.90.0040.00417.41
8.1.80.0040.00417.47
8.1.70.0050.00217.46
8.1.60.0040.00417.55
8.1.50.0000.00917.55
8.1.40.0060.00317.51
8.1.30.0040.00417.63
8.1.20.0050.00217.60
8.1.10.0040.00417.56
8.1.00.0000.00817.57
8.0.300.0030.00619.89
8.0.290.0050.00217.04
8.0.280.0000.00818.52
8.0.270.0050.00317.30
8.0.260.0030.00317.29
8.0.250.0000.00716.98
8.0.240.0040.00417.02
8.0.230.0070.00017.02
8.0.220.0040.00416.91
8.0.210.0030.00316.91
8.0.200.0000.00817.00
8.0.190.0000.00817.06
8.0.180.0040.00416.91
8.0.170.0080.00017.05
8.0.160.0040.00417.03
8.0.150.0000.00816.88
8.0.140.0050.00216.94
8.0.130.0060.00013.45
8.0.120.0070.00016.87
8.0.110.0050.00316.94
8.0.100.0000.00816.85
8.0.90.0040.00417.03
8.0.80.0180.00316.95
8.0.70.0040.00416.80
8.0.60.0040.00417.04
8.0.50.0040.00416.77
8.0.30.0080.01117.05
8.0.20.0120.00617.40
8.0.10.0080.00017.02
8.0.00.0050.01216.84
7.4.330.0000.00515.00
7.4.320.0040.00416.47
7.4.300.0030.00316.62
7.4.290.0000.00716.51
7.4.280.0070.00016.51
7.4.270.0000.00716.61
7.4.260.0050.00216.60
7.4.250.0040.00416.59
7.4.240.0030.00316.63
7.4.230.0030.00316.68
7.4.220.0120.00516.52
7.4.210.0080.00816.57
7.4.200.0040.00416.70
7.4.190.0080.00016.77
7.4.160.0060.01916.52
7.4.150.0070.01117.40
7.4.140.0080.00817.86
7.4.130.0080.00816.64
7.4.120.0100.00916.46
7.4.110.0030.01516.50
7.4.100.0120.00616.61
7.4.90.0000.01716.51
7.4.80.0150.00919.39
7.4.70.0060.01216.60
7.4.60.0140.00316.51
7.4.50.0040.00416.13
7.4.40.0120.00322.77
7.4.30.0110.00716.82
7.4.10.0080.00815.02
7.4.00.0090.00914.87
7.3.330.0060.00013.21
7.3.320.0000.00513.31
7.3.310.0000.00716.48
7.3.300.0050.00316.37
7.3.290.0090.01216.39
7.3.280.0060.01016.36
7.3.270.0120.00617.40
7.3.260.0120.00816.67
7.3.250.0090.01016.45
7.3.240.0150.00316.52
7.3.230.0040.01316.59
7.3.210.0080.00816.33
7.3.200.0030.01319.39
7.3.190.0120.01216.51
7.3.180.0100.00616.37
7.3.170.0060.00916.46
7.3.160.0030.01316.41
7.3.130.0090.00914.71
7.3.120.0070.01015.00
7.3.110.0050.01115.01
7.3.100.0100.00714.77
7.3.90.0120.00214.89
7.3.80.0030.01015.05
7.3.70.0040.00914.85
7.3.60.0050.00514.62
7.3.50.0100.00114.88
7.3.40.0040.01014.88
7.3.30.0050.00814.73
7.3.20.0100.00416.76
7.3.10.0060.00716.54
7.3.00.0070.00516.57
7.2.330.0160.00016.80
7.2.320.0100.00716.61
7.2.310.0060.01016.41
7.2.300.0030.01316.78
7.2.290.0060.01316.86
7.2.260.0040.01615.27
7.2.250.0050.01215.12
7.2.240.0070.01115.07
7.2.230.0080.00715.21
7.2.220.0050.01214.97
7.2.210.0050.01115.16
7.2.200.0090.00614.93
7.2.190.0040.01215.04
7.2.180.0070.00715.02
7.2.170.0050.01015.12
7.2.160.0040.00715.20
7.2.150.0110.00416.86
7.2.140.0000.01216.93
7.2.130.0030.01216.96
7.2.120.0130.00316.91
7.2.110.0030.00616.92
7.2.100.0080.00816.97
7.2.90.0070.00717.04
7.2.80.0060.00916.81
7.2.70.0120.00317.00
7.2.60.0080.00816.68
7.2.50.0040.01116.87
7.2.40.0040.01116.99
7.2.30.0000.01416.88
7.2.20.0040.00816.94
7.2.10.0070.01116.61
7.2.00.0070.00418.37
7.1.330.0060.00815.67
7.1.320.0050.01115.79
7.1.310.0020.01315.79
7.1.300.0050.00915.72
7.1.290.0070.00515.79
7.1.280.0050.00715.76
7.1.270.0050.00815.72
7.1.260.0050.00615.72
7.1.250.0110.00416.00
7.1.240.0150.00315.80
7.1.230.0060.00815.67
7.1.220.0050.00515.93
7.1.210.0000.01415.67
7.1.200.0070.00715.86
7.1.190.0000.01215.91
7.1.180.0090.00615.75
7.1.170.0070.00715.70
7.1.160.0070.01015.83
7.1.150.0040.00715.88
7.1.140.0050.00515.83
7.1.130.0000.01015.76
7.1.120.0000.01215.92
7.1.110.0040.00715.51
7.1.100.0050.00816.99
7.1.90.0060.01015.82
7.1.80.0120.00015.79
7.1.70.0050.00716.23
7.1.60.0120.00817.54
7.1.50.0070.01116.09
7.1.40.0000.01515.94
7.1.30.0030.00715.45
7.1.20.0000.00915.49
7.1.10.0070.00715.51
7.1.00.0030.04519.06
7.0.330.0070.00715.55
7.0.320.0030.00915.19
7.0.310.0060.00315.23
7.0.300.0070.00715.11
7.0.290.0060.00315.41
7.0.280.0030.01015.51
7.0.270.0000.01415.25
7.0.260.0060.00315.42
7.0.250.0030.00715.37
7.0.240.0110.00315.57
7.0.230.0090.00615.61
7.0.220.0000.01115.44
7.0.210.0000.01215.47
7.0.200.0050.00416.10
7.0.190.0050.00515.48
7.0.180.0060.00315.34
7.0.170.0100.00015.58
7.0.160.0000.00915.49
7.0.150.0030.00715.34
7.0.140.0050.03618.68
7.0.130.0030.00915.49
7.0.120.0060.00615.47
7.0.110.0060.00315.36
7.0.100.0070.00315.34
7.0.90.0070.00415.34
7.0.80.0070.00315.34
7.0.70.0060.00615.46
7.0.60.0110.03617.74
7.0.50.0070.04216.75
7.0.40.0050.03716.79
7.0.30.0220.03516.76
7.0.20.0150.04916.94
7.0.10.0080.03816.91
7.0.00.0150.04216.65
5.6.400.0040.00414.37
5.6.390.0070.00714.22
5.6.380.0080.00514.66
5.6.370.0040.00814.37
5.6.360.0030.01314.27
5.6.350.0000.00914.45
5.6.340.0040.00414.18
5.6.330.0030.00614.40
5.6.320.0120.00314.58
5.6.310.0000.01414.22
5.6.300.0030.01014.22
5.6.290.0000.01014.48
5.6.280.0100.03517.70
5.6.270.0060.00614.72
5.6.260.0040.00714.48
5.6.250.0060.00314.39
5.6.240.0030.00914.37
5.6.230.0150.00314.48
5.6.220.0000.00914.23
5.6.210.0100.04017.55
5.6.200.0030.04716.20
5.6.190.0080.03717.54
5.6.180.0110.02117.43
5.6.170.0170.02517.38
5.6.160.0100.03517.39
5.6.150.0070.04516.22
5.6.140.0070.02116.34
5.6.130.0070.04216.29
5.6.120.0060.04817.55
5.6.110.0120.04017.85
5.6.100.0060.02617.64
5.6.90.0070.04117.54
5.6.80.0100.04317.33
5.6.70.1950.01217.46
5.6.60.0030.01314.26
5.6.50.0030.01314.42
5.6.40.0060.01014.41
5.6.30.0030.00614.15
5.6.20.0000.01414.30
5.6.10.0100.00714.16
5.6.00.0040.01014.26
5.5.380.0000.01314.30
5.5.370.0100.00614.33
5.5.360.0120.00014.48
5.5.350.0150.04217.33
5.5.340.0100.04216.14
5.5.330.0070.03717.31
5.5.320.0240.02217.35
5.5.310.0190.04417.18
5.5.300.0090.04416.22
5.5.290.0070.03716.12
5.5.280.0030.02717.63
5.5.270.0100.04217.66
5.5.260.0060.04517.59
5.5.250.0020.04817.42
5.5.240.2070.02717.19
5.5.230.0080.00414.31
5.5.220.0000.01214.50
5.5.210.0040.00914.40
5.5.200.0090.00614.44
5.5.190.0030.00713.85
5.5.180.0070.00714.24
5.5.170.0000.01414.33
5.5.160.0030.00914.35
5.5.150.0030.01314.39
5.5.140.0070.00714.55
5.5.130.0070.01114.41
5.5.120.0030.01414.16
5.5.110.0040.01114.52
5.5.100.0080.00814.35
5.5.90.0040.00714.19
5.5.80.0000.01114.15
5.5.70.0060.01014.33
5.5.60.0000.00914.36
5.5.50.0000.00914.41
5.5.40.0070.00714.41
5.5.30.0080.00814.48
5.5.20.0030.01014.39
5.5.10.0040.00814.60
5.5.00.0040.01114.06
5.4.450.1430.02015.30
5.4.440.1500.03015.16
5.4.430.1330.02715.31
5.4.420.1430.02015.28
5.4.410.1470.02615.26
5.4.400.1270.02415.11
5.4.390.1360.02214.99
5.4.380.1440.02314.90
5.4.370.1410.01715.08
5.4.360.1390.02015.28
5.4.350.1280.02215.05
5.4.340.1370.02215.21
5.4.330.0080.00311.32
5.4.320.1230.02415.24
5.4.310.1530.02615.16
5.4.300.1450.01815.15
5.4.290.1500.02015.21
5.4.280.1440.02215.14
5.4.270.1330.01615.13
5.4.260.1250.02414.97
5.4.250.1400.02515.04
5.4.240.1270.02315.13
5.4.230.1180.02314.88
5.4.220.1500.02615.05
5.4.210.1320.02114.96
5.4.200.1370.02015.29
5.4.190.1350.02415.04
5.4.180.1270.02314.93
5.4.170.1230.02814.97
5.4.160.1510.02715.29
5.4.150.1360.02314.96
5.4.140.1450.02213.75
5.4.130.1120.02013.60
5.4.120.1020.02213.73
5.4.110.1280.02213.88
5.4.100.1330.01713.75
5.4.90.1380.02013.92
5.4.80.1370.02213.66
5.4.70.1400.01713.93
5.4.60.1300.02113.57
5.4.50.1320.02613.65
5.4.40.1220.02213.70
5.4.30.1470.02013.89
5.4.20.1390.02113.77
5.4.10.1320.02213.77
5.4.00.1250.01913.40
5.3.290.1320.02312.39
5.3.280.1290.02212.41
5.3.270.1400.02012.49
5.3.260.1480.02512.38
5.3.250.1320.01812.44
5.3.240.1380.01812.36
5.3.230.1360.02412.48
5.3.220.1450.02512.49
5.3.210.1310.02012.46
5.3.200.1300.02212.39
5.3.190.0050.04112.43
5.3.180.0030.02312.43
5.3.170.0050.04012.46
5.3.160.0730.02712.63
5.3.150.1470.02212.41
5.3.140.1370.02612.46
5.3.130.1350.01812.41
5.3.120.1370.02512.43
5.3.110.1440.02412.48
5.3.100.1470.02612.16
5.3.90.1430.02112.12
5.3.80.1440.01712.11
5.3.70.1410.02312.03
5.3.60.1300.02012.25
5.3.50.1280.02112.08
5.3.40.1430.02512.04
5.3.30.1320.02112.11
5.3.20.1320.02012.01
5.3.10.1320.02011.94
5.3.00.1280.02011.96
5.2.170.2070.03311.27
5.2.160.2130.02311.23
5.2.150.2170.02311.16
5.2.140.2370.03311.23
5.2.130.2330.03011.02
5.2.120.2100.03311.16
5.2.110.2100.03011.20
5.2.100.1700.03011.26
5.2.90.2370.03011.20
5.2.80.2170.03311.04
5.2.70.2670.03311.02
5.2.60.2230.03711.05
5.2.50.2100.02310.95
5.2.40.1670.02710.91
5.2.30.0370.02310.88
5.2.20.0070.05710.94
5.2.10.0070.04010.94
5.2.00.0030.04710.64
5.1.60.0070.04710.05
5.1.50.1100.03010.13
5.1.40.1600.02310.04
5.1.30.1770.03010.39
5.1.20.1600.03010.43
5.1.10.1600.02710.05
5.1.00.1870.02710.20
5.0.50.0870.0208.66
5.0.40.0830.0178.39
5.0.30.1030.0308.24
5.0.20.0930.0178.33
5.0.10.0930.0278.12
5.0.00.0800.0338.16
4.4.90.1100.0207.23
4.4.80.1000.0237.23
4.4.70.1030.0237.23
4.4.60.1000.0237.23
4.4.50.0830.0137.23
4.4.40.0800.0277.23
4.4.30.0800.0177.23
4.4.20.1000.0177.23
4.4.10.1000.0137.23
4.4.00.1030.0337.23
4.3.110.0830.0137.23
4.3.100.0970.0107.23
4.3.90.1000.0207.23
4.3.80.0800.0237.23
4.3.70.0900.0177.23
4.3.60.0830.0107.23
4.3.50.0970.0207.23
4.3.40.0870.0207.23
4.3.30.0530.0277.23
4.3.20.0400.0177.23
4.3.10.0530.0307.23
4.3.00.0470.0207.23

preferences:
45.11 ms | 404 KiB | 6 Q