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); $answer = $answerTime($that); return $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.0110.00416.75
8.3.50.0240.00722.00
8.3.40.0130.00618.82
8.3.30.0040.01119.06
8.3.20.0070.00020.33
8.3.10.0000.00823.66
8.3.00.0000.01019.38
8.2.180.0170.00318.16
8.2.170.0040.01122.96
8.2.160.0130.00020.53
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00422.24
8.2.110.0090.00022.13
8.2.100.0090.00318.03
8.2.90.0000.00819.05
8.2.80.0040.00417.97
8.2.70.0060.00617.63
8.2.60.0040.00417.80
8.2.50.0030.00918.07
8.2.40.0030.00719.83
8.2.30.0000.00718.09
8.2.20.0000.00817.62
8.2.10.0070.00018.05
8.2.00.0080.00317.75
8.1.280.0070.01025.92
8.1.270.0040.00424.02
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0100.00023.84
8.1.230.0070.00318.99
8.1.220.0000.00817.74
8.1.210.0030.00518.77
8.1.200.0040.00417.25
8.1.190.0040.00417.55
8.1.180.0040.00818.10
8.1.170.0030.00618.49
8.1.160.0000.00722.02
8.1.150.0000.01018.57
8.1.140.0070.00017.51
8.1.130.0000.00717.72
8.1.120.0070.00017.42
8.1.110.0080.00017.41
8.1.100.0070.00317.47
8.1.90.0040.00417.34
8.1.80.0000.00717.47
8.1.70.0050.00317.47
8.1.60.0000.00917.48
8.1.50.0040.00417.40
8.1.40.0000.00817.56
8.1.30.0040.00417.54
8.1.20.0040.00417.65
8.1.10.0000.00817.55
8.1.00.0040.00417.52
8.0.300.0050.00220.79
8.0.290.0040.00417.04
8.0.280.0030.00318.45
8.0.270.0040.00417.27
8.0.260.0000.00617.23
8.0.250.0030.00316.95
8.0.240.0080.00017.04
8.0.230.0070.00016.98
8.0.220.0000.00716.96
8.0.210.0000.00716.87
8.0.200.0000.00617.04
8.0.190.0040.00416.93
8.0.180.0020.00517.04
8.0.170.0030.00516.88
8.0.160.0000.00716.94
8.0.150.0070.00016.91
8.0.140.0000.00716.97
8.0.130.0030.00313.35
8.0.120.0050.00316.81
8.0.110.0050.00217.00
8.0.100.0000.00816.90
8.0.90.0000.00717.03
8.0.80.0110.00616.89
8.0.70.0040.00416.98
8.0.60.0000.00816.82
8.0.50.0000.00716.93
8.0.30.0110.00717.02
8.0.20.0090.01317.40
8.0.10.0060.00317.13
8.0.00.0100.00916.73
7.4.330.0020.00215.00
7.4.320.0060.00016.46
7.4.300.0000.00616.63
7.4.290.0000.00816.63
7.4.280.0040.00416.52
7.4.270.0040.00416.59
7.4.260.0070.00016.49
7.4.250.0000.00816.57
7.4.240.0020.00616.52
7.4.230.0030.00316.59
7.4.220.0150.00916.48
7.4.210.0060.00916.56
7.4.200.0030.00516.39
7.4.190.0040.00416.46
7.4.160.0090.00616.34
7.4.150.0100.00717.40
7.4.140.0130.00817.86
7.4.130.0070.01216.43
7.4.120.0110.00916.56
7.4.110.0100.00716.74
7.4.100.0140.00916.66
7.4.90.0130.00716.49
7.4.80.0180.00019.39
7.4.70.0120.00616.52
7.4.60.0040.01116.39
7.4.50.0080.00016.65
7.4.40.0090.00622.77
7.4.30.0110.00716.62
7.4.10.0030.01414.99
7.4.00.0060.00815.01
7.3.330.0000.00513.38
7.3.320.0030.00313.38
7.3.310.0070.00016.25
7.3.300.0050.00316.36
7.3.290.0160.00016.26
7.3.280.0060.01016.33
7.3.270.0100.00717.40
7.3.260.0140.00316.45
7.3.250.0120.00816.42
7.3.240.0040.01216.58
7.3.230.0030.01316.39
7.3.210.0090.00916.50
7.3.200.0190.00519.39
7.3.190.0000.02216.50
7.3.180.0080.00816.42
7.3.170.0100.00716.35
7.3.160.0060.00916.52
7.3.130.0090.00914.92
7.3.120.0110.00614.89
7.3.110.0050.01014.82
7.3.100.0030.01014.93
7.3.90.0090.00914.81
7.3.80.0090.00714.87
7.3.70.0040.00914.81
7.3.60.0070.00614.69
7.3.50.0080.01014.90
7.3.40.0070.00814.82
7.3.30.0050.00914.60
7.3.20.0060.00716.46
7.3.10.0060.00816.67
7.3.00.0080.00616.66
7.2.330.0080.00816.50
7.2.320.0100.00716.86
7.2.310.0100.01016.70
7.2.300.0130.00316.47
7.2.290.0070.01016.76
7.2.260.0070.00714.99
7.2.250.0080.00915.07
7.2.240.0080.00815.37
7.2.230.0070.01015.02
7.2.220.0100.00715.11
7.2.210.0080.01015.20
7.2.200.0050.00715.04
7.2.190.0050.00815.10
7.2.180.0040.00715.13
7.2.170.0040.01214.91
7.2.160.0040.00814.75
7.2.150.0030.01016.72
7.2.140.0040.01616.88
7.2.130.0110.00716.98
7.2.120.0090.00616.61
7.2.110.0070.00716.82
7.2.100.0000.01016.67
7.2.90.0090.00616.93
7.2.80.0030.01416.99
7.2.70.0040.00817.09
7.2.60.0060.00316.79
7.2.50.0090.00616.64
7.2.40.0060.00616.59
7.2.30.0030.00616.75
7.2.20.0130.00316.96
7.2.10.0090.00916.74
7.2.00.0060.00418.18
7.1.330.0070.00815.75
7.1.320.0060.00615.62
7.1.310.0070.01015.63
7.1.300.0020.01015.71
7.1.290.0060.00815.83
7.1.280.0080.00515.56
7.1.270.0020.01015.80
7.1.260.0070.00615.82
7.1.250.0030.00715.69
7.1.240.0030.01315.85
7.1.230.0040.00415.71
7.1.220.0000.01315.66
7.1.210.0030.01015.73
7.1.200.0030.01215.91
7.1.190.0030.00915.77
7.1.180.0060.00915.80
7.1.170.0060.00615.55
7.1.160.0090.00315.83
7.1.150.0030.00715.71
7.1.140.0090.00315.90
7.1.130.0060.00315.89
7.1.120.0070.00415.66
7.1.110.0060.00615.84
7.1.100.0040.00817.06
7.1.90.0060.00915.98
7.1.80.0030.01015.85
7.1.70.0020.01316.40
7.1.60.0080.01217.56
7.1.50.0050.01216.31
7.1.40.0090.00615.85
7.1.30.0030.00715.93
7.1.20.0120.00315.52
7.1.10.0040.00415.62
7.1.00.0090.03819.07
7.0.330.0030.00615.35
7.0.320.0100.00615.50
7.0.310.0070.00715.33
7.0.300.0000.00815.29
7.0.290.0060.00615.14
7.0.280.0060.00915.36
7.0.270.0030.00715.61
7.0.260.0030.01015.19
7.0.250.0090.00615.32
7.0.240.0030.00615.21
7.0.230.0030.00915.60
7.0.220.0030.00915.45
7.0.210.0000.00915.45
7.0.200.0060.00516.03
7.0.190.0100.00715.56
7.0.180.0080.00415.57
7.0.170.0060.00615.55
7.0.160.0030.00915.30
7.0.150.0090.00015.38
7.0.140.0050.04018.62
7.0.130.0000.01415.22
7.0.120.0080.00015.35
7.0.110.0110.00415.49
7.0.100.0030.01015.24
7.0.90.0040.00415.62
7.0.80.0030.01015.37
7.0.70.0030.01015.38
7.0.60.0050.02517.60
7.0.50.0110.02016.69
7.0.40.0050.03316.90
7.0.30.0170.04416.75
7.0.20.0160.02816.70
7.0.10.0050.03416.67
7.0.00.0100.04316.82
5.6.400.0090.00614.35
5.6.390.0040.00813.98
5.6.380.0030.01014.22
5.6.370.0060.00614.66
5.6.360.0060.00614.19
5.6.350.0000.01714.41
5.6.340.0040.01214.66
5.6.330.0090.00614.35
5.6.320.0130.00014.18
5.6.310.0000.01314.61
5.6.300.0030.01414.29
5.6.290.0070.01014.52
5.6.280.0070.03617.65
5.6.270.0060.00614.46
5.6.260.0100.00314.34
5.6.250.0060.00314.60
5.6.240.0070.00714.27
5.6.230.0030.00914.28
5.6.220.0120.00314.07
5.6.210.0050.03717.38
5.6.200.0090.04516.24
5.6.190.0050.04817.51
5.6.180.0120.03217.70
5.6.170.0200.04417.45
5.6.160.0050.02517.36
5.6.150.0080.04016.39
5.6.140.0060.02616.15
5.6.130.0040.04916.28
5.6.120.0070.04517.64
5.6.110.0020.03417.79
5.6.100.0050.02917.63
5.6.90.0040.04717.83
5.6.80.0050.03817.40
5.6.70.0090.00014.15
5.6.60.0030.01014.28
5.6.50.0040.00414.04
5.6.40.0030.00714.34
5.6.30.0090.00614.19
5.6.20.0090.00614.59
5.6.10.0070.00414.16
5.6.00.0030.00614.35
5.5.380.0030.01014.38
5.5.370.0070.00714.27
5.5.360.0040.01114.48
5.5.350.0150.01517.24
5.5.340.0040.03216.17
5.5.330.0050.04717.25
5.5.320.0200.02017.22
5.5.310.0170.04017.23
5.5.300.0020.02916.17
5.5.290.0070.02816.26
5.5.280.0050.04917.79
5.5.270.0070.04217.61
5.5.260.0050.03917.76
5.5.250.0060.04017.56
5.5.240.0080.04717.11
5.5.230.0030.01113.96
5.5.220.0060.00614.20
5.5.210.0100.00313.97
5.5.200.0110.00014.15
5.5.190.0100.00314.16
5.5.180.0080.00414.45
5.5.170.0070.00714.30
5.5.160.0000.01314.39
5.5.150.0090.00614.02
5.5.140.0030.01314.42
5.5.130.0030.01014.08
5.5.120.0030.01013.87
5.5.110.0030.01014.28
5.5.100.0040.01114.32
5.5.90.0060.00914.36
5.5.80.0060.00614.36
5.5.70.0030.01314.10
5.5.60.0070.01014.25
5.5.50.0040.00714.34
5.5.40.0030.00814.10
5.5.30.0070.00714.29
5.5.20.0100.00713.88
5.5.10.0100.00313.91
5.5.00.0040.00814.29
5.4.450.0380.03615.31
5.4.440.0400.02315.28
5.4.430.0120.02715.23
5.4.420.0330.03515.11
5.4.410.0480.02815.19
5.4.400.0320.03614.97
5.4.390.0500.03915.06
5.4.380.0210.02814.95
5.4.370.0230.02314.89
5.4.360.0220.02915.02
5.4.350.0190.02914.86
5.4.340.0200.02814.74
5.4.330.0070.00411.37
5.4.320.0040.02311.85
5.4.310.0070.02311.77
5.4.300.0050.02211.75
5.4.290.0080.03611.82
5.4.280.0070.03011.69
5.4.270.0050.03011.55
5.4.260.0090.04211.77
5.4.250.0120.03711.70
5.4.240.0100.05411.85
5.4.230.0120.05411.79
5.4.220.0040.02811.72
5.4.210.0090.04411.55
5.4.200.0080.02811.70
5.4.190.0070.04211.68
5.4.180.0070.03811.76
5.4.170.0080.03411.68
5.4.160.0070.03911.83
5.4.150.0120.04211.69
5.4.140.0100.04911.46
5.4.130.0050.02611.57
5.4.120.0030.02411.56
5.4.110.0070.02211.54
5.4.100.0060.02311.52
5.4.90.0050.02311.54
5.4.80.0020.02611.41
5.4.70.0040.02211.53
5.4.60.0050.02011.64
5.4.50.0060.02111.58
5.4.40.0050.02311.54
5.4.30.0060.02511.45
5.4.20.0090.02611.50
5.4.10.0050.03111.47
5.4.00.0040.03911.29
5.3.290.0040.02411.76
5.3.280.0040.03611.61
5.3.270.0090.02711.69
5.3.260.0090.03011.69
5.3.250.0090.03311.66
5.3.240.0060.03111.63
5.3.230.0060.02711.66
5.3.220.0040.03611.65
5.3.210.0080.03211.58
5.3.200.0090.03211.60
5.3.190.0050.03011.63
5.3.180.0080.03311.62
5.3.170.0030.03311.54
5.3.160.0060.02611.70
5.3.150.0060.02911.68
5.3.140.0020.03211.53
5.3.130.0070.02911.62
5.3.120.0070.02911.58
5.3.110.0060.02911.65
5.3.100.0050.02711.37
5.3.90.0070.02711.22
5.3.80.0090.03711.29
5.3.70.0040.03011.30
5.3.60.0090.03511.33
5.3.50.0120.02511.29
5.3.40.0080.03311.29
5.3.30.0050.02611.29
5.3.20.0060.03411.16
5.3.10.0060.02911.02
5.3.00.0050.02911.01
5.2.170.0050.0469.22
5.2.160.0090.0429.22
5.2.150.0090.0449.22
5.2.140.0040.0469.22
5.2.130.0100.0289.18
5.2.120.0080.0359.18
5.2.110.0080.0369.19
5.2.100.0030.0379.19
5.2.90.0040.0339.19
5.2.80.0080.0319.18
5.2.70.0060.0349.19
5.2.60.0060.0379.14
5.2.50.0100.0679.10
5.2.40.0050.0379.08
5.2.30.0040.0389.06
5.2.20.0240.0799.05
5.2.10.0060.0358.95
5.2.00.0070.0368.82
5.1.60.0120.0478.09
5.1.50.0040.0368.09
5.1.40.0080.0488.08
5.1.30.0110.0398.42
5.1.20.0100.0418.44
5.1.10.0060.0408.17
5.1.00.0050.0398.17
5.0.50.0050.0286.65
5.0.40.0050.0266.51
5.0.30.0060.0466.32
5.0.20.0050.0216.28
5.0.10.0050.0226.27
5.0.00.0040.0436.26
4.4.90.0070.0304.78
4.4.80.0060.0264.75
4.4.70.0080.0264.75
4.4.60.0080.0214.75
4.4.50.0050.0244.77
4.4.40.0070.0724.71
4.4.30.0030.0204.76
4.4.20.0020.0244.84
4.4.10.0050.0214.85
4.4.00.0040.0274.76
4.3.110.0040.0234.67
4.3.100.0070.0364.67
4.3.90.0090.0414.63
4.3.80.0060.0434.58
4.3.70.0100.0314.63
4.3.60.0070.0274.63
4.3.50.0040.0234.63
4.3.40.0060.0334.54
4.3.30.0060.0643.30
4.3.20.0020.0243.28
4.3.10.0030.0223.24
4.3.00.0100.01010.54

preferences:
50.12 ms | 401 KiB | 5 Q