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($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.0080.00816.63
8.3.50.0100.00722.10
8.3.40.0140.00318.79
8.3.30.0140.00018.81
8.3.20.0040.00420.22
8.3.10.0050.00323.66
8.3.00.0040.00419.13
8.2.180.0070.01118.41
8.2.170.0090.00622.96
8.2.160.0050.00820.43
8.2.150.0070.00024.18
8.2.140.0000.00824.66
8.2.130.0000.00826.16
8.2.120.0040.00422.25
8.2.110.0030.00621.87
8.2.100.0120.00017.91
8.2.90.0000.00719.09
8.2.80.0000.00817.97
8.2.70.0000.01117.38
8.2.60.0000.00817.80
8.2.50.0040.00418.07
8.2.40.0000.00819.88
8.2.30.0040.00418.05
8.2.20.0040.00417.56
8.2.10.0000.00718.12
8.2.00.0000.01017.75
8.1.280.0110.00425.92
8.1.270.0060.00323.82
8.1.260.0050.00326.35
8.1.250.0070.00028.09
8.1.240.0050.00523.79
8.1.230.0090.00319.09
8.1.220.0050.00317.74
8.1.210.0040.00418.77
8.1.200.0030.00617.36
8.1.190.0000.00817.51
8.1.180.0030.00618.10
8.1.170.0030.00618.59
8.1.160.0070.00021.91
8.1.150.0070.00318.77
8.1.140.0000.00717.40
8.1.130.0030.00317.76
8.1.120.0000.00717.38
8.1.110.0040.00417.49
8.1.100.0030.00617.39
8.1.90.0050.00217.48
8.1.80.0050.00317.38
8.1.70.0000.00917.36
8.1.60.0030.00617.52
8.1.50.0050.00317.50
8.1.40.0050.00217.43
8.1.30.0050.00317.62
8.1.20.0000.00717.56
8.1.10.0000.00717.59
8.1.00.0040.00417.50
8.0.300.0040.00420.66
8.0.290.0050.00217.16
8.0.280.0030.00518.37
8.0.270.0030.00317.23
8.0.260.0030.00317.10
8.0.250.0040.00416.99
8.0.240.0030.00616.99
8.0.230.0040.00416.91
8.0.220.0070.00016.93
8.0.210.0000.00716.92
8.0.200.0030.00316.93
8.0.190.0050.00317.00
8.0.180.0060.00316.93
8.0.170.0040.00417.02
8.0.160.0050.00316.77
8.0.150.0040.00416.87
8.0.140.0050.00216.91
8.0.130.0030.00313.34
8.0.120.0080.00016.96
8.0.110.0000.00816.99
8.0.100.0000.00717.00
8.0.90.0000.00716.84
8.0.80.0090.00916.95
8.0.70.0030.00317.00
8.0.60.0070.00017.00
8.0.50.0040.00416.83
8.0.30.0150.00317.17
8.0.20.0120.00617.40
8.0.10.0030.00317.04
8.0.00.0100.01216.77
7.4.330.0050.00015.00
7.4.320.0030.00316.62
7.4.300.0000.00716.61
7.4.290.0000.00716.61
7.4.280.0070.00016.60
7.4.270.0000.00716.52
7.4.260.0080.00016.61
7.4.250.0070.00016.54
7.4.240.0020.00516.52
7.4.230.0000.00716.55
7.4.220.0040.01416.48
7.4.210.0050.00916.55
7.4.200.0000.00716.59
7.4.190.0040.00416.70
7.4.160.0130.00316.50
7.4.150.0000.01817.40
7.4.140.0090.00917.86
7.4.130.0090.00916.71
7.4.120.0130.00816.50
7.4.110.0170.00016.37
7.4.100.0090.00916.55
7.4.90.0170.00016.41
7.4.80.0140.00519.39
7.4.70.0030.01316.63
7.4.60.0060.01116.54
7.4.50.0040.00416.43
7.4.40.0090.00922.77
7.4.30.0030.01516.46
7.4.00.0050.01415.14
7.3.330.0030.00313.34
7.3.320.0000.00513.36
7.3.310.0020.00516.26
7.3.300.0000.00716.31
7.3.290.0110.00716.42
7.3.280.0080.01316.36
7.3.270.0100.00617.40
7.3.260.0060.01216.42
7.3.250.0100.00816.48
7.3.240.0120.00616.60
7.3.230.0080.00816.50
7.3.210.0110.00616.42
7.3.200.0060.01719.39
7.3.190.0040.01616.37
7.3.180.0110.00516.57
7.3.170.0120.00916.47
7.3.160.0060.00916.42
7.3.120.0110.00614.86
7.3.110.0090.00914.69
7.3.100.0090.00914.94
7.3.90.0070.01014.84
7.3.80.0100.00315.05
7.3.70.0070.00314.89
7.3.60.0040.00414.65
7.3.50.0040.00714.85
7.3.40.0090.00014.83
7.3.30.0060.01014.67
7.3.20.0090.00616.67
7.3.10.0020.01216.68
7.3.00.0070.00916.61
7.2.330.0160.00016.72
7.2.320.0030.01316.71
7.2.310.0120.00616.68
7.2.300.0050.01016.93
7.2.290.0110.00616.75
7.2.250.0110.00614.84
7.2.240.0120.00614.87
7.2.230.0130.00315.14
7.2.220.0030.00915.02
7.2.210.0030.01215.30
7.2.200.0040.00715.03
7.2.190.0040.01115.24
7.2.180.0060.00915.19
7.2.170.0050.00515.13
7.2.160.0000.01615.13
7.2.150.0070.00717.00
7.2.140.0070.00717.07
7.2.130.0050.01117.10
7.2.120.0040.00816.85
7.2.110.0030.01116.89
7.2.100.0070.00517.02
7.2.90.0120.00516.97
7.2.80.0050.01116.90
7.2.70.0100.00216.90
7.2.60.0090.00616.99
7.2.50.0050.00716.93
7.2.40.0060.00816.75
7.2.30.0040.01316.79
7.2.20.0030.01016.96
7.2.10.0030.01016.95
7.2.00.0040.01117.82
7.1.330.0030.01415.93
7.1.320.0040.01115.72
7.1.310.0120.00815.53
7.1.300.0090.00615.86
7.1.290.0110.00015.70
7.1.280.0000.01315.65
7.1.270.0060.00315.71
7.1.260.0030.01015.83
7.1.250.0060.00915.77
7.1.240.0070.00715.87
7.1.230.0040.00815.70
7.1.220.0080.00815.97
7.1.210.0060.00915.70
7.1.200.0030.00915.77
7.1.190.0100.00715.79
7.1.180.0080.00415.73
7.1.170.0060.01015.61
7.1.160.0070.00315.93
7.1.150.0070.00715.93
7.1.140.0040.00715.77
7.1.130.0040.01115.88
7.1.120.0070.01015.61
7.1.110.0040.00816.00
7.1.100.0080.00617.02
7.1.90.0060.00615.87
7.1.80.0060.00915.61
7.1.70.0050.00816.30
7.1.60.0050.01217.67
7.1.50.0050.01116.18
7.1.40.0040.00415.82
7.1.30.0060.00615.72
7.1.20.0070.01015.58
7.1.10.0090.00615.96
7.1.00.0070.03919.13
7.0.330.0030.01014.98
7.0.320.0060.00915.46
7.0.310.0030.00615.29
7.0.300.0060.00915.41
7.0.290.0040.01214.96
7.0.280.0000.01315.39
7.0.270.0060.00615.35
7.0.260.0090.00315.16
7.0.250.0030.00715.32
7.0.240.0090.00015.53
7.0.230.0030.01015.36
7.0.220.0070.00415.51
7.0.210.0090.00315.24
7.0.200.0060.00416.01
7.0.190.0030.01015.16
7.0.180.0030.00715.36
7.0.170.0030.00515.29
7.0.160.0030.01015.44
7.0.150.0030.01015.19
7.0.140.0050.03818.71
7.0.130.0000.00915.53
7.0.120.0040.01115.38
7.0.110.0110.00415.46
7.0.100.0060.00615.43
7.0.90.0060.00615.24
7.0.80.0000.01415.56
7.0.70.0070.01015.52
7.0.60.0050.04417.52
7.0.50.0070.03216.63
7.0.40.0060.02217.33
7.0.30.0160.03617.38
7.0.20.0150.03517.45
7.0.10.0030.03817.47
7.0.00.0130.04017.51
5.6.400.0100.00314.65
5.6.390.0140.00314.65
5.6.380.0040.01114.65
5.6.370.0000.01214.65
5.6.360.0070.01014.65
5.6.350.0060.01014.65
5.6.340.0100.00314.65
5.6.330.0080.00814.65
5.6.320.0060.00314.65
5.6.310.0040.01114.65
5.6.300.0110.00314.65
5.6.290.0100.00314.65
5.6.280.0070.03917.79
5.6.270.0120.00314.65
5.6.260.0040.00714.65
5.6.250.0060.00814.65
5.6.240.0030.01014.65
5.6.230.0060.00314.65
5.6.220.0000.01114.65
5.6.210.0050.04017.56
5.6.200.0040.02516.41
5.6.190.0120.04117.54
5.6.180.0070.04317.63
5.6.170.0150.04617.56
5.6.160.0050.03417.52
5.6.150.0030.03416.44
5.6.140.0060.03016.46
5.6.130.0050.02216.41
5.6.120.0030.03717.84
5.6.110.0150.04017.83
5.6.100.0070.04817.83
5.6.90.0060.04017.84
5.6.80.0070.02017.47
5.6.70.0130.00014.65
5.6.60.0060.00914.65
5.6.50.0100.00714.65
5.6.40.0090.00314.65
5.6.30.0030.01014.65
5.6.20.0040.01214.65
5.6.10.0000.00814.65
5.6.00.0000.01314.65
5.5.380.0070.00714.65
5.5.370.0030.00714.65
5.5.360.0100.01014.65
5.5.350.0030.02517.58
5.5.340.0070.04316.30
5.5.330.0030.03917.53
5.5.320.0150.02017.50
5.5.310.0220.02717.43
5.5.300.0050.04916.31
5.5.290.0050.02816.37
5.5.280.0080.04417.73
5.5.270.0030.02617.76
5.5.260.0130.04117.65
5.5.250.0070.04417.62
5.5.240.0030.04817.41
5.5.230.0100.00614.65
5.5.220.0100.00714.65
5.5.210.0030.01314.65
5.5.200.0040.00814.65
5.5.190.0110.00714.65
5.5.180.0080.00014.65
5.5.170.0060.00314.65
5.5.160.0030.01314.65
5.5.150.0040.00414.65
5.5.140.0060.00614.65
5.5.130.0000.01314.65
5.5.120.0050.00314.65
5.5.110.0060.00314.65
5.5.100.0000.01014.65
5.5.90.0160.00314.65
5.5.80.0100.00614.65
5.5.70.0030.01414.65
5.5.60.0000.01514.65
5.5.50.0100.00314.65
5.5.40.0060.00914.65
5.5.30.0030.00614.65
5.5.20.0030.01214.65
5.5.10.0090.00314.65
5.5.00.0040.01114.65
5.4.450.0310.02516.92
5.4.440.0210.01817.02
5.4.430.0530.01817.07
5.4.420.0610.01617.10
5.4.410.0330.02517.03
5.4.400.0350.02416.98
5.4.390.0430.02316.93
5.4.380.0250.03016.70
5.4.370.0220.02516.61
5.4.360.0200.02816.72
5.4.350.0220.02716.69
5.4.340.0150.03016.66
5.4.330.0050.00214.65
5.4.320.0040.01913.57
5.4.310.0100.02313.57
5.4.300.0060.02113.58
5.4.290.0050.02113.57
5.4.280.0080.02313.52
5.4.270.0070.02313.52
5.4.260.0050.02413.52
5.4.250.0050.04113.52
5.4.240.0070.02413.51
5.4.230.0020.02513.51
5.4.220.0060.02913.51
5.4.210.0050.02213.51
5.4.200.0080.02113.51
5.4.190.0060.02113.51
5.4.180.0060.02013.51
5.4.170.0060.02013.51
5.4.160.0040.02413.52
5.4.150.0060.02013.51
5.4.140.0040.03213.35
5.4.130.0080.02713.35
5.4.120.0060.02813.33
5.4.110.0070.02813.32
5.4.100.0140.04513.33
5.4.90.0050.03013.32
5.4.80.0040.02913.32
5.4.70.0050.03013.32
5.4.60.0070.02913.32
5.4.50.0030.03213.32
5.4.40.0130.03913.32
5.4.30.0080.04113.31
5.4.20.0070.03413.32
5.4.10.0100.03313.31
5.4.00.0050.02313.06
5.3.290.0050.02213.72
5.3.280.0060.02813.68
5.3.270.0090.03013.69
5.3.260.0040.03313.68
5.3.250.0050.03413.69
5.3.240.0040.03413.68
5.3.230.0080.02813.68
5.3.220.0060.03313.67
5.3.210.0080.02113.66
5.3.200.0050.02213.66
5.3.190.0050.02413.66
5.3.180.0060.02113.66
5.3.170.0050.02313.66
5.3.160.0080.02913.66
5.3.150.0050.02813.66
5.3.140.0090.04013.66
5.3.130.0100.02313.65
5.3.120.0090.03713.65
5.3.110.0090.04013.65
5.3.100.0070.02413.39
5.3.90.0060.02813.38
5.3.80.0070.02313.38
5.3.70.0030.02313.38
5.3.60.0050.02113.37
5.3.50.0050.02113.35
5.3.40.0080.02013.34
5.3.30.0050.02113.32
5.3.20.0070.02113.21
5.3.10.0050.02013.20
5.3.00.0050.02713.19
5.2.170.0030.0359.23
5.2.160.0030.0349.23
5.2.150.0040.0359.23
5.2.140.0130.0519.23
5.2.130.0080.0559.19
5.2.120.0080.0639.19
5.2.110.0090.0389.20
5.2.100.0080.0419.19
5.2.90.0060.0619.19
5.2.80.0070.0389.19
5.2.70.0080.0429.18
5.2.60.0060.0439.14
5.2.50.0170.0689.11
5.2.40.0070.0399.09
5.2.30.0090.0449.07
5.2.20.0050.0449.05
5.2.10.0050.0418.95
5.2.00.0080.0668.82
5.1.60.0090.0498.10
5.1.50.0120.0498.10
5.1.40.0100.0698.08
5.1.30.0070.0298.43
5.1.20.0070.0298.45
5.1.10.0080.0358.18
5.1.00.0050.0388.18
5.0.50.0110.0426.66
5.0.40.0080.0216.51
5.0.30.0070.0476.33
5.0.20.0090.0336.29
5.0.10.0030.0446.27
5.0.00.0040.0506.26
4.4.90.0030.0254.77
4.4.80.0040.0214.75
4.4.70.0070.0264.75
4.4.60.0050.0424.75
4.4.50.0020.0274.77
4.4.40.0050.0364.70
4.4.30.0040.0164.76
4.4.20.0030.0204.84
4.4.10.0050.0164.85
4.4.00.0020.0284.76
4.3.110.0040.0174.67
4.3.100.0040.0164.67
4.3.90.0030.0164.63
4.3.80.0050.0254.59
4.3.70.0060.0124.63
4.3.60.0020.0164.63
4.3.50.0030.0164.63
4.3.40.0040.0254.54
4.3.30.0030.0173.30
4.3.20.0010.0193.28
4.3.10.0040.0173.24
4.3.00.0100.01313.47

preferences:
55.17 ms | 400 KiB | 5 Q