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->$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.0080.00816.48
8.3.50.0060.00922.11
8.3.40.0130.00618.98
8.3.30.0060.00919.04
8.3.20.0040.00419.91
8.3.10.0040.00423.52
8.3.00.0000.00819.25
8.2.180.0130.01316.38
8.2.170.0090.00622.96
8.2.160.0100.00320.41
8.2.150.0100.01024.18
8.2.140.0060.00324.66
8.2.130.0050.00326.16
8.2.120.0040.00422.12
8.2.110.0000.00822.11
8.2.100.0090.00317.84
8.2.90.0000.00718.98
8.2.80.0050.00317.97
8.2.70.0040.00417.50
8.2.60.0040.00417.93
8.2.50.0050.00318.07
8.2.40.0060.00319.88
8.2.30.0040.00417.95
8.2.20.0000.00817.76
8.2.10.0060.00318.13
8.2.00.0000.01117.66
8.1.280.0070.01425.92
8.1.270.0040.00423.97
8.1.260.0040.00426.35
8.1.250.0050.00228.09
8.1.240.0000.00923.92
8.1.230.0000.01019.04
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0030.00617.35
8.1.190.0050.00317.63
8.1.180.0000.00818.10
8.1.170.0000.00818.47
8.1.160.0030.00522.03
8.1.150.0030.00618.56
8.1.140.0030.00617.42
8.1.130.0030.00317.84
8.1.120.0040.00417.41
8.1.110.0050.00317.39
8.1.100.0000.01017.46
8.1.90.0000.00717.47
8.1.80.0040.00417.35
8.1.70.0000.00817.47
8.1.60.0000.00817.45
8.1.50.0060.00317.54
8.1.40.0040.00417.43
8.1.30.0040.00417.65
8.1.20.0000.00717.58
8.1.10.0090.00017.63
8.1.00.0040.00417.41
8.0.300.0040.00420.53
8.0.290.0000.00817.18
8.0.280.0070.00018.45
8.0.270.0030.00317.19
8.0.260.0030.00317.18
8.0.250.0030.00317.07
8.0.240.0080.00017.05
8.0.230.0040.00417.05
8.0.220.0000.00716.98
8.0.210.0070.00016.99
8.0.200.0060.00016.87
8.0.190.0040.00417.04
8.0.180.0040.00416.99
8.0.170.0040.00416.86
8.0.160.0000.00716.95
8.0.150.0080.00016.84
8.0.140.0040.00416.83
8.0.130.0060.00013.39
8.0.120.0070.00016.96
8.0.110.0000.00717.01
8.0.100.0000.00716.93
8.0.90.0000.00816.95
8.0.80.0060.01316.99
8.0.70.0000.00717.04
8.0.60.0050.00316.83
8.0.50.0070.00017.00
8.0.30.0050.01517.19
8.0.20.0150.00417.40
8.0.10.0050.00317.13
8.0.00.0090.00816.82
7.4.330.0050.00015.00
7.4.320.0040.00416.66
7.4.300.0070.00016.57
7.4.290.0080.00016.50
7.4.280.0050.00316.64
7.4.270.0040.00416.54
7.4.260.0030.00316.43
7.4.250.0040.00416.49
7.4.240.0020.00516.48
7.4.230.0040.00416.50
7.4.220.0090.00916.69
7.4.210.0090.00616.68
7.4.200.0000.00816.41
7.4.190.0000.00716.61
7.4.160.0090.00616.48
7.4.150.0100.01017.40
7.4.140.0130.00417.86
7.4.130.0060.01116.58
7.4.120.0080.01016.56
7.4.110.0110.00816.58
7.4.100.0100.01116.39
7.4.90.0130.01016.34
7.4.80.0100.01019.39
7.4.70.0100.00716.51
7.4.60.0000.01716.42
7.4.50.0030.00516.28
7.4.40.0090.00622.77
7.4.30.0120.00616.42
7.4.00.0060.00915.16
7.3.330.0000.00613.32
7.3.320.0060.00013.18
7.3.310.0070.00016.40
7.3.300.0030.00516.45
7.3.290.0070.00716.38
7.3.280.0060.01016.38
7.3.270.0100.00717.40
7.3.260.0040.01316.34
7.3.250.0130.00416.48
7.3.240.0080.00816.58
7.3.230.0040.01716.47
7.3.210.0140.00316.47
7.3.200.0100.01319.39
7.3.190.0040.01916.57
7.3.180.0080.00816.46
7.3.170.0110.00916.41
7.3.160.0070.01016.42
7.3.120.0120.00514.92
7.3.110.0050.00814.79
7.3.100.0080.00714.75
7.3.90.0050.01014.82
7.3.80.0070.01014.92
7.3.70.0070.00714.86
7.3.60.0040.01114.91
7.3.50.0100.00314.80
7.3.40.0100.00514.86
7.3.30.0070.00914.81
7.3.20.0060.00816.74
7.3.10.0060.00616.51
7.3.00.0100.00516.43
7.2.330.0090.00616.70
7.2.320.0090.00916.68
7.2.310.0090.00616.50
7.2.300.0100.00716.67
7.2.290.0090.00916.79
7.2.250.0070.01015.08
7.2.240.0050.01015.15
7.2.230.0030.01215.15
7.2.220.0040.01114.87
7.2.210.0050.01215.16
7.2.200.0070.01014.96
7.2.190.0090.00514.91
7.2.180.0030.00815.01
7.2.170.0030.01414.84
7.2.160.0020.01214.95
7.2.150.0080.00716.96
7.2.140.0080.00316.87
7.2.130.0070.00916.79
7.2.120.0050.01316.83
7.2.110.0030.01317.04
7.2.100.0040.01116.93
7.2.90.0060.00816.76
7.2.80.0040.01316.88
7.2.70.0030.00816.77
7.2.60.0030.01116.79
7.2.50.0030.01016.70
7.2.40.0070.01016.87
7.2.30.0040.01016.96
7.2.20.0060.00616.88
7.2.10.0050.01116.98
7.2.00.0050.00917.90
7.1.330.0070.00915.84
7.1.320.0050.00815.82
7.1.310.0050.00615.71
7.1.300.0050.00815.69
7.1.290.0040.00815.66
7.1.280.0090.00515.54
7.1.270.0080.00615.72
7.1.260.0050.00815.63
7.1.250.0070.00815.77
7.1.240.0130.00615.80
7.1.230.0030.01015.75
7.1.220.0070.01015.55
7.1.210.0090.00315.84
7.1.200.0030.00815.71
7.1.190.0080.00415.77
7.1.180.0000.01315.52
7.1.170.0070.00715.87
7.1.160.0000.01715.74
7.1.150.0060.00615.77
7.1.140.0140.00415.57
7.1.130.0110.00015.78
7.1.120.0060.00615.59
7.1.110.0070.01015.80
7.1.100.0050.01016.68
7.1.90.0030.01416.04
7.1.80.0100.00715.54
7.1.70.0100.00316.45
7.1.60.0080.01117.60
7.1.50.0090.00816.28
7.1.40.0070.00715.80
7.1.30.0060.01015.71
7.1.20.0040.01115.67
7.1.10.0070.01015.95
7.1.00.0060.04119.22
7.0.330.0100.00715.53
7.0.320.0040.00815.36
7.0.310.0030.01015.48
7.0.300.0030.01015.64
7.0.290.0040.00415.57
7.0.280.0100.00315.16
7.0.270.0110.00415.41
7.0.260.0070.01015.07
7.0.250.0030.00715.43
7.0.240.0070.00715.11
7.0.230.0040.00715.37
7.0.220.0000.01315.39
7.0.210.0040.01115.42
7.0.200.0030.00816.10
7.0.190.0060.00715.49
7.0.180.0090.00315.33
7.0.170.0100.00315.19
7.0.160.0040.00715.20
7.0.150.0060.00615.15
7.0.140.0050.04018.76
7.0.130.0070.00715.50
7.0.120.0040.04018.77
7.0.110.0000.03318.87
7.0.100.0100.03218.90
7.0.90.0030.04418.82
7.0.80.0070.03318.74
7.0.70.0020.04418.77
7.0.60.0050.04018.79
7.0.50.0070.04018.89
7.0.40.0090.03718.36
7.0.30.0050.03818.40
7.0.20.0020.03318.42
7.0.10.0060.02818.36
7.0.00.0000.04318.36
5.6.400.0000.00914.65
5.6.390.0070.01014.65
5.6.380.0060.00314.65
5.6.370.0060.00914.65
5.6.360.0070.01014.65
5.6.350.0070.00714.65
5.6.340.0100.00314.65
5.6.330.0090.00914.65
5.6.320.0070.00714.65
5.6.310.0050.00514.65
5.6.300.0060.00614.65
5.6.290.0030.01014.65
5.6.280.0050.03717.85
5.6.270.0040.01114.65
5.6.260.0060.03117.86
5.6.250.0040.04017.87
5.6.240.0030.03817.85
5.6.230.0030.05017.79
5.6.220.0030.04017.72
5.6.210.0080.02817.86
5.6.200.0030.03517.80
5.6.190.0080.04017.83
5.6.180.0030.04217.85
5.6.170.0020.04017.73
5.6.160.0050.04117.84
5.6.150.0020.03817.84
5.6.140.0020.03217.73
5.6.130.0020.03717.85
5.6.120.0040.03817.73
5.6.110.0020.04317.70
5.6.100.0060.02817.83
5.6.90.0050.03917.84
5.6.80.0040.03317.45
5.6.70.0070.03217.54
5.6.60.0000.04417.52
5.6.50.0050.03417.48
5.6.40.0060.03317.48
5.6.30.0040.04017.46
5.6.20.0000.04617.38
5.6.10.0040.03617.42
5.6.00.0050.02717.44
5.5.380.0040.03416.12
5.5.370.0050.04116.17
5.5.360.0020.02916.10
5.5.350.0030.03816.06
5.5.340.0040.04116.45
5.5.330.0050.03416.38
5.5.320.0030.03716.29
5.5.310.0040.03616.45
5.5.300.0000.03916.44
5.5.290.0010.03616.37
5.5.280.0020.02916.28
5.5.270.0050.03816.26
5.5.260.0030.03616.44
5.5.250.0020.04116.28
5.5.240.0030.03615.97
5.5.230.0070.03915.97
5.5.220.0050.03316.14
5.5.210.0000.04215.98
5.5.200.0020.03715.98
5.5.190.0020.03615.98
5.5.180.0020.04216.11
5.5.170.0030.00614.65
5.5.160.0050.02716.03
5.5.150.0060.03716.11
5.5.140.0070.03215.96
5.5.130.0070.03216.03
5.5.120.0070.03515.96
5.5.110.0020.03516.02
5.5.100.0020.03816.07
5.5.90.0080.03215.86
5.5.80.0030.03816.00
5.5.70.0050.03916.00
5.5.60.0050.03515.92
5.5.50.0030.03916.06
5.5.40.0080.02816.06
5.5.30.0050.03815.86
5.5.20.0030.04015.90
5.5.10.0030.03315.90
5.5.00.0000.03516.01
5.4.450.0000.02616.98
5.4.440.0030.03316.98
5.4.430.0000.02716.98
5.4.420.0020.03117.00
5.4.410.0030.03716.90
5.4.400.0020.03816.87
5.4.390.0060.03516.98
5.4.380.0040.03716.82
5.4.370.0050.03216.89
5.4.360.0060.03616.98
5.4.350.0020.03816.82
5.4.340.0060.03116.89
5.4.330.0030.00614.65
5.4.320.0080.02816.81
5.4.310.0050.02516.90
5.4.300.0030.03316.83
5.4.290.0030.03516.87
5.4.280.0040.03516.82
5.4.270.0050.03616.91
5.4.260.0050.03616.79
5.4.250.0030.03716.98
5.4.240.0010.03816.94
5.4.230.0050.03416.81
5.4.220.0020.03416.99
5.4.210.0020.03516.81
5.4.200.0020.03316.94
5.4.190.0060.02816.93
5.4.180.0030.03516.91
5.4.170.0050.04216.97
5.4.160.0020.02716.81
5.4.150.0040.03116.89
5.4.140.0030.03215.53
5.4.130.0020.03515.53
5.4.120.0030.03615.50
5.4.110.0070.02915.55
5.4.100.0000.03715.60
5.4.90.0030.03315.55
5.4.80.0030.03715.50
5.4.70.0050.03215.59
5.4.60.0040.03515.59
5.4.50.0030.03515.49
5.4.40.0040.03315.61
5.4.30.0020.03315.63
5.4.20.0020.02815.46
5.4.10.0000.02915.49
5.4.00.0050.02515.28
5.3.290.0070.03214.59
5.3.280.0070.03014.56
5.3.270.0060.03514.63
5.3.260.0030.03814.63
5.3.250.0000.03714.70
5.3.240.0050.03014.63
5.3.230.0020.03714.74
5.3.220.0030.03714.63
5.3.210.0050.03714.68
5.3.200.0020.03314.67
5.3.190.0000.03814.61
5.3.180.0060.03314.63
5.3.170.0030.03314.54
5.3.160.0030.03714.60
5.3.150.0000.04014.73
5.3.140.0030.03614.61
5.3.130.0050.03814.71
5.3.120.0000.02514.60
5.3.110.0020.04114.65
5.3.100.0050.03514.36
5.3.90.0060.03114.34
5.3.80.0030.03014.38
5.3.70.0030.03614.35
5.3.60.0030.03314.33
5.3.50.0020.03214.31
5.3.40.0020.02714.38
5.3.30.0010.03314.26
5.3.20.0020.02714.18
5.3.10.0030.01714.27
5.3.00.0060.02914.15
5.2.170.0000.06011.00
5.2.160.0000.04711.11
5.2.150.0030.05311.28
5.2.140.0100.04711.00
5.2.130.0030.05011.34
5.2.120.0000.04011.33
5.2.110.0030.02711.10
5.2.100.0000.05310.98
5.2.90.0030.05311.11
5.2.80.0000.06011.18
5.2.70.0000.05311.22
5.2.60.0030.05311.14
5.2.50.0000.04711.13
5.2.40.0000.05710.96
5.2.30.0030.04310.96
5.2.20.0000.04011.04
5.2.10.0030.03010.82
5.2.00.0000.05710.68
5.1.60.0000.0379.82
5.1.50.0030.0309.98
5.1.40.0030.0409.96
5.1.30.0000.04010.35
5.1.20.0000.04310.34
5.1.10.0030.04710.06
5.1.00.0070.04310.08
5.0.50.0000.0379.79
5.0.40.0000.0239.79
5.0.30.0000.0539.79
5.0.20.0030.0309.79
5.0.10.0000.0339.79
5.0.00.0000.0509.79
4.4.90.0000.0309.79
4.4.80.0000.0279.79
4.4.70.0000.0239.79
4.4.60.0000.0309.79
4.4.50.0000.0239.79
4.4.40.0030.0479.79
4.4.30.0000.0309.79
4.4.20.0000.0239.79
4.4.10.0030.0209.79
4.4.00.0000.0409.79
4.3.110.0030.0309.79
4.3.100.0000.0309.79
4.3.90.0000.0309.79
4.3.80.0030.0439.79
4.3.70.0000.0209.79
4.3.60.0000.0279.79
4.3.50.0000.0309.79
4.3.40.0000.0409.79
4.3.30.0000.0239.79
4.3.20.0030.0279.79
4.3.10.0000.0339.79
4.3.00.0000.0339.79

preferences:
45.96 ms | 401 KiB | 5 Q