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 function getAnswer($that) { // Closure::bind() actually creates a new instance of the closure $sweetsThief = Closure::bind($this->sweetsThief, null, $that); var_dump($sweetsThief); } public function sweetsThief($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.0040.01116.63
8.3.50.0130.01122.07
8.3.40.0090.00618.66
8.3.30.0030.01019.09
8.3.20.0080.00020.16
8.3.10.0040.00423.56
8.3.00.0040.00419.26
8.2.180.0110.00818.56
8.2.170.0070.01422.96
8.2.160.0090.00520.18
8.2.150.0030.00524.18
8.2.140.0040.00424.66
8.2.130.0090.00926.16
8.2.120.0000.00722.25
8.2.110.0060.00322.21
8.2.100.0110.00017.91
8.2.90.0000.00819.23
8.2.80.0080.00018.04
8.2.70.0000.00817.47
8.2.60.0000.00819.65
8.2.50.0000.00818.07
8.2.40.0090.00019.76
8.2.30.0030.00617.89
8.2.20.0080.00017.69
8.2.10.0000.00818.00
8.2.00.0000.01117.77
8.1.280.0070.00725.92
8.1.270.0030.00623.85
8.1.260.0000.00826.35
8.1.250.0070.00728.09
8.1.240.0060.00323.88
8.1.230.0070.00319.04
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0090.00017.35
8.1.190.0000.00817.65
8.1.180.0030.00618.10
8.1.170.0050.00318.63
8.1.160.0040.00422.04
8.1.150.0060.00618.66
8.1.140.0040.00417.43
8.1.130.0000.00717.77
8.1.120.0020.00517.50
8.1.110.0020.00517.49
8.1.100.0030.00617.41
8.1.90.0080.00017.41
8.1.80.0040.00417.31
8.1.70.0000.00717.36
8.1.60.0030.00617.59
8.1.50.0000.00817.40
8.1.40.0000.00817.45
8.1.30.0000.00917.49
8.1.20.0090.00017.74
8.1.10.0090.00017.52
8.1.00.0040.00417.58
8.0.300.0000.00719.09
8.0.290.0040.00417.30
8.0.280.0000.00718.42
8.0.270.0030.00317.22
8.0.260.0030.00317.22
8.0.250.0000.00817.01
8.0.240.0000.00716.96
8.0.230.0040.00416.91
8.0.220.0000.00716.93
8.0.210.0070.00016.96
8.0.200.0030.00316.99
8.0.190.0030.00516.98
8.0.180.0060.00616.92
8.0.170.0050.00216.92
8.0.160.0030.00517.05
8.0.150.0000.00716.73
8.0.140.0030.00516.94
8.0.130.0070.00013.46
8.0.120.0040.00416.91
8.0.110.0050.00317.01
8.0.100.0080.00016.83
8.0.90.0040.00417.04
8.0.80.0110.00716.86
8.0.70.0030.00317.04
8.0.60.0030.00516.86
8.0.50.0040.00416.93
8.0.30.0070.01217.10
8.0.20.0090.00917.40
8.0.10.0000.00717.20
8.0.00.0160.00616.84
7.4.330.0050.00015.00
7.4.320.0040.00416.58
7.4.300.0040.00416.52
7.4.290.0030.00316.56
7.4.280.0080.00016.41
7.4.270.0000.00816.60
7.4.260.0000.00816.51
7.4.250.0040.00416.59
7.4.240.0020.00616.63
7.4.230.0000.00716.73
7.4.220.0080.00916.63
7.4.210.0100.00716.61
7.4.200.0040.00216.69
7.4.190.0070.00016.59
7.4.160.0030.01416.34
7.4.150.0100.00717.40
7.4.140.0130.00517.86
7.4.130.0070.01216.71
7.4.120.0070.01016.70
7.4.110.0110.00716.72
7.4.100.0090.01016.54
7.4.90.0190.00416.49
7.4.80.0030.01319.39
7.4.70.0060.00916.74
7.4.60.0070.01016.63
7.4.50.0080.00016.43
7.4.40.0070.01122.77
7.4.30.0060.00916.44
7.4.10.0000.01814.79
7.4.00.0050.01215.08
7.3.330.0000.00713.33
7.3.320.0000.00613.21
7.3.310.0000.00716.34
7.3.300.0030.00616.41
7.3.290.0070.00716.30
7.3.280.0090.00916.40
7.3.270.0080.00817.40
7.3.260.0200.01816.61
7.3.250.0060.01116.61
7.3.240.0130.01016.43
7.3.230.0110.00716.60
7.3.210.0070.01316.48
7.3.200.0050.01519.39
7.3.190.0060.01616.47
7.3.180.0130.00316.47
7.3.170.0070.01016.44
7.3.160.0090.01216.54
7.3.130.0070.00714.63
7.3.120.0050.01214.96
7.3.110.0090.00914.87
7.3.100.0100.00714.59
7.3.90.0100.00014.57
7.3.80.0060.00314.98
7.3.70.0070.00714.67
7.3.60.0060.00314.89
7.3.50.0030.00614.67
7.3.40.0120.00315.01
7.3.30.0040.00714.66
7.3.20.0030.01216.71
7.3.10.0040.01116.46
7.3.00.0040.01116.57
7.2.330.0030.01316.69
7.2.320.0090.00916.77
7.2.310.0120.00616.73
7.2.300.0190.02616.79
7.2.290.0070.01016.61
7.2.260.0070.01114.85
7.2.250.0070.01015.22
7.2.240.0070.00715.30
7.2.230.0090.00615.03
7.2.220.0150.00315.31
7.2.210.0100.00315.22
7.2.200.0110.00315.04
7.2.190.0070.00715.18
7.2.180.0000.01315.20
7.2.170.0060.00815.13
7.2.160.0040.01115.13
7.2.150.0070.00717.18
7.2.140.0060.00616.68
7.2.130.0090.00617.09
7.2.120.0000.01416.93
7.2.110.0040.01116.93
7.2.100.0090.00316.84
7.2.90.0000.01016.94
7.2.80.0040.00916.91
7.2.70.0030.00617.03
7.2.60.0090.00616.93
7.2.50.0070.01316.70
7.2.40.0100.01017.18
7.2.30.0070.00717.18
7.2.20.0120.00316.95
7.2.10.0030.00916.94
7.2.00.0030.01118.22
7.1.330.0070.00716.02
7.1.320.0070.01016.01
7.1.310.0100.00315.64
7.1.300.0070.00715.97
7.1.290.0070.00715.58
7.1.280.0070.00415.95
7.1.270.0060.00915.74
7.1.260.0040.00715.97
7.1.250.0090.00615.55
7.1.240.0040.00415.51
7.1.230.0070.00715.85
7.1.220.0100.00415.55
7.1.210.0090.00615.79
7.1.200.0080.00515.91
7.1.190.0070.00715.86
7.1.180.0060.00815.78
7.1.170.0040.01115.91
7.1.160.0120.00315.48
7.1.150.0060.00615.77
7.1.140.0080.00615.83
7.1.130.0120.00015.52
7.1.120.0060.01015.79
7.1.110.0030.01015.77
7.1.100.0050.00617.04
7.1.90.0020.01115.82
7.1.80.0030.01015.73
7.1.70.0040.00716.36
7.1.60.0060.01317.63
7.1.50.0060.01316.43
7.1.40.0070.00715.51
7.1.30.0030.00715.78
7.1.20.0030.01015.64
7.1.10.0070.00715.76
7.1.00.0050.04319.10
7.0.330.0030.00715.39
7.0.320.0070.01015.25
7.0.310.0030.00715.55
7.0.300.0070.01015.30
7.0.290.0030.01015.34
7.0.280.0000.01515.41
7.0.270.0110.00415.50
7.0.260.0090.00615.47
7.0.250.0000.01515.31
7.0.240.0030.00615.61
7.0.230.0100.00015.66
7.0.220.0060.00615.31
7.0.210.0030.00615.59
7.0.200.0070.00116.01
7.0.190.0070.00715.40
7.0.180.0040.00715.20
7.0.170.0080.00415.49
7.0.160.0000.01315.36
7.0.150.0040.01115.27
7.0.140.0030.03918.68
7.0.130.0030.00915.61
7.0.120.0060.00915.60
7.0.110.0070.00715.27
7.0.100.0170.03217.59
7.0.90.0230.04017.62
7.0.80.0070.04317.74
7.0.70.0020.04417.60
7.0.60.0050.03217.77
7.0.50.0080.03317.90
7.0.40.0080.04316.77
7.0.30.0090.04316.84
7.0.20.0050.02616.71
7.0.10.0020.04716.67
7.0.00.0030.04016.71
5.6.400.0040.01114.52
5.6.390.0040.01114.28
5.6.380.0030.00614.34
5.6.370.0070.00714.15
5.6.360.0030.01014.66
5.6.350.0120.00314.42
5.6.340.0030.00614.55
5.6.330.0040.00714.61
5.6.320.0000.00814.34
5.6.310.0030.01014.40
5.6.300.0040.00714.58
5.6.290.0110.00014.51
5.6.280.0010.04417.71
5.6.270.0090.00614.42
5.6.260.0080.00814.29
5.6.250.0090.02317.70
5.6.240.0110.03017.47
5.6.230.0100.02817.51
5.6.220.0070.03017.46
5.6.210.0050.04417.48
5.6.200.0090.04517.56
5.6.190.0120.03717.67
5.6.180.0100.03817.84
5.6.170.0030.03817.76
5.6.160.0040.03217.68
5.6.150.0080.03017.62
5.6.140.0090.04717.60
5.6.130.0050.03717.64
5.6.120.0110.04317.79
5.6.110.0070.03817.65
5.6.100.0100.03817.62
5.6.90.0080.03717.53
5.6.80.0050.03417.20
5.6.70.0100.03817.31
5.6.60.0130.03717.36
5.6.50.0090.02517.17
5.6.40.0050.04417.20
5.6.30.0070.04217.41
5.6.20.0050.03117.26
5.6.10.0030.04217.23
5.6.00.0070.03517.19
5.5.380.0030.02717.36
5.5.370.0080.04317.34
5.5.360.0100.02217.29
5.5.350.0120.04217.40
5.5.340.0070.04117.47
5.5.330.0080.04617.35
5.5.320.0030.04517.63
5.5.310.0050.05017.56
5.5.300.0110.02317.38
5.5.290.0100.03517.65
5.5.280.0150.03717.62
5.5.270.0100.02317.51
5.5.260.0050.04717.62
5.5.250.0070.04217.46
5.5.240.0130.02517.25
5.5.230.0030.04517.21
5.5.220.0030.03917.27
5.5.210.0050.04317.23
5.5.200.0020.02717.24
5.5.190.0080.02717.30
5.5.180.0090.04317.17
5.5.170.0040.00714.03
5.5.160.0070.03717.25
5.5.150.0090.03917.22
5.5.140.0110.03417.12
5.5.130.0100.02817.20
5.5.120.0050.03217.30
5.5.110.0120.03717.18
5.5.100.0090.02217.19
5.5.90.0070.03717.19
5.5.80.0020.03317.20
5.5.70.0070.04317.16
5.5.60.0110.02317.15
5.5.50.0050.04117.17
5.5.40.0070.03817.22
5.5.30.0030.02817.09
5.5.20.0070.04317.08
5.5.10.0080.02616.89
5.5.00.0020.04917.07
5.4.450.0050.04315.25
5.4.440.0070.04215.25
5.4.430.0110.03415.25
5.4.420.0100.03315.27
5.4.410.0030.04015.24
5.4.400.0050.04014.80
5.4.390.0030.02614.96
5.4.380.0030.04215.13
5.4.370.0030.04114.76
5.4.360.0000.02915.09
5.4.350.0080.03015.11
5.4.340.0100.04014.88
5.4.330.0000.00810.96
5.4.320.0080.04014.87
5.4.310.0050.03715.13
5.4.300.0070.04015.05
5.4.290.0100.02015.03
5.4.280.0080.02514.91
5.4.270.0070.03915.18
5.4.260.0100.02315.13
5.4.250.0030.03715.11
5.4.240.0020.03514.97
5.4.230.0050.03915.04
5.4.220.0080.01814.94
5.4.210.0030.04114.88
5.4.200.0050.02515.13
5.4.190.0030.04915.07
5.4.180.0030.04514.94
5.4.170.0050.03914.91
5.4.160.0050.04215.24
5.4.150.0030.04214.95
5.4.140.0030.03913.65
5.4.130.0070.02813.63
5.4.120.0050.03113.75
5.4.110.0030.03113.88
5.4.100.0050.03213.64
5.4.90.0060.02313.69
5.4.80.0050.03813.79
5.4.70.0030.02513.82
5.4.60.0030.03913.86
5.4.50.0080.03813.78
5.4.40.0100.03313.69
5.4.30.0050.03713.79
5.4.20.0090.03713.73
5.4.10.0080.03513.63
5.4.00.0040.02413.43
5.3.290.0050.02512.53
5.3.280.0000.02412.58
5.3.270.0130.03512.53
5.3.260.0050.03512.59
5.3.250.0030.04312.57
5.3.240.0040.03912.57
5.3.230.0020.02712.58
5.3.220.0050.03712.47
5.3.210.0050.02812.61
5.3.200.0050.04012.49
5.3.190.0070.04212.58
5.3.180.0070.04012.67
5.3.170.0130.03312.66
5.3.160.0060.03512.58
5.3.150.0050.04012.53
5.3.140.0090.03712.49
5.3.130.0020.03712.66
5.3.120.0000.03212.56
5.3.110.0070.04012.46
5.3.100.0080.01812.38
5.3.90.0040.03912.25
5.3.80.0060.03712.24
5.3.70.0080.03512.22
5.3.60.0030.03012.27
5.3.50.0070.03212.20
5.3.40.0090.01912.26
5.3.30.0020.02512.16
5.3.20.0060.02112.03
5.3.10.0000.02212.11
5.3.00.0030.02112.09
5.2.170.0000.03311.24
5.2.160.0000.03311.09
5.2.150.0070.02711.18
5.2.140.0000.03311.08
5.2.130.0030.03011.20
5.2.120.0000.03011.18
5.2.110.0000.03710.97
5.2.100.0030.02711.25
5.2.90.0000.03011.22
5.2.80.0000.03311.24
5.2.70.0000.03011.01
5.2.60.0000.03011.05
5.2.50.0030.02711.16
5.2.40.0030.02711.09
5.2.30.0030.02711.03
5.2.20.0000.03311.03
5.2.10.0000.03010.93
5.2.00.0030.02710.81
5.1.60.0070.0209.84
5.1.50.0000.02710.09
5.1.40.0070.0209.98
5.1.30.0030.02310.44
5.1.20.0070.02310.42
5.1.10.0030.0279.96
5.1.00.0000.02710.18
5.0.50.0030.0208.69
5.0.40.0030.0208.69
5.0.30.0030.0308.69
5.0.20.0000.0208.69
5.0.10.0000.0208.69
5.0.00.0000.0338.69
4.4.90.0030.0138.69
4.4.80.0030.0138.69
4.4.70.0030.0138.69
4.4.60.0000.0138.69
4.4.50.0070.0108.69
4.4.40.0000.0238.69
4.4.30.0000.0178.69
4.4.20.0030.0138.69
4.4.10.0000.0138.69
4.4.00.0000.0278.69
4.3.110.0030.0138.69
4.3.100.0000.0178.69
4.3.90.0070.0108.69
4.3.80.0000.0278.69
4.3.70.0000.0178.69
4.3.60.0030.0138.69
4.3.50.0000.0178.69
4.3.40.0000.0238.69
4.3.30.0030.0138.69
4.3.20.0030.0138.69
4.3.10.0030.0138.69
4.3.00.0000.0178.69

preferences:
43.56 ms | 401 KiB | 5 Q