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($that), null, $that); var_dump($this->sweetsThief($that)); } 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.0070.00716.75
8.3.50.0160.00522.05
8.3.40.0090.00919.02
8.3.30.0110.00619.05
8.3.20.0070.00020.21
8.3.10.0000.00723.67
8.3.00.0040.00419.36
8.2.180.0190.00316.75
8.2.170.0100.01022.96
8.2.160.0070.00720.29
8.2.150.0040.00424.18
8.2.140.0000.00724.66
8.2.130.0050.00326.16
8.2.120.0070.00322.13
8.2.110.0060.00320.35
8.2.100.0030.00917.78
8.2.90.0030.00518.94
8.2.80.0040.00418.04
8.2.70.0040.00417.63
8.2.60.0040.00417.89
8.2.50.0060.00318.10
8.2.40.0000.00720.46
8.2.30.0040.00418.08
8.2.20.0040.00417.72
8.2.10.0040.00418.06
8.2.00.0070.00317.71
8.1.280.0110.00425.92
8.1.270.0030.00623.91
8.1.260.0090.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00323.77
8.1.230.0090.00319.17
8.1.220.0000.00817.76
8.1.210.0040.00418.77
8.1.200.0000.00917.48
8.1.190.0080.00017.23
8.1.180.0040.00418.10
8.1.170.0080.00018.64
8.1.160.0000.00722.06
8.1.150.0000.01018.68
8.1.140.0040.00417.47
8.1.130.0030.00317.87
8.1.120.0000.00717.54
8.1.110.0070.00017.53
8.1.100.0070.00317.50
8.1.90.0000.00717.50
8.1.80.0000.00817.46
8.1.70.0000.00717.39
8.1.60.0060.00317.60
8.1.50.0030.00517.40
8.1.40.0040.00417.51
8.1.30.0030.00517.64
8.1.20.0040.00417.59
8.1.10.0040.00417.59
8.1.00.0040.00417.51
8.0.300.0040.00420.07
8.0.290.0080.00016.75
8.0.280.0000.00818.34
8.0.270.0000.00717.23
8.0.260.0050.00217.27
8.0.250.0000.00716.98
8.0.240.0030.00617.04
8.0.230.0030.00316.94
8.0.220.0070.00016.92
8.0.210.0040.00416.93
8.0.200.0030.00317.04
8.0.190.0060.00316.87
8.0.180.0040.00716.85
8.0.170.0030.00616.98
8.0.160.0030.00316.87
8.0.150.0030.00316.83
8.0.140.0000.00716.88
8.0.130.0050.00013.36
8.0.120.0060.00316.94
8.0.110.0080.00017.04
8.0.100.0070.00016.98
8.0.90.0040.00416.79
8.0.80.0070.00717.02
8.0.70.0000.00816.88
8.0.60.0000.00716.95
8.0.50.0040.00417.00
8.0.30.0100.01116.91
8.0.20.0120.00817.40
8.0.10.0040.00416.98
8.0.00.0140.00316.83
7.4.330.0020.00215.00
7.4.320.0000.00716.55
7.4.300.0000.00616.39
7.4.290.0000.00716.47
7.4.280.0030.00316.63
7.4.270.0040.00416.64
7.4.260.0070.00016.57
7.4.250.0050.00316.65
7.4.240.0020.00616.64
7.4.230.0030.00316.44
7.4.220.0130.00316.55
7.4.210.0090.00916.57
7.4.200.0000.00816.74
7.4.190.0070.00016.79
7.4.160.0110.00716.47
7.4.150.0070.01117.40
7.4.140.0080.00917.86
7.4.130.0100.00816.73
7.4.120.0120.00416.59
7.4.110.0120.00616.66
7.4.100.0110.01116.44
7.4.90.0030.01316.56
7.4.80.0080.01219.39
7.4.70.0170.00316.65
7.4.60.0070.01016.61
7.4.50.0060.00316.67
7.4.40.0000.01522.77
7.4.30.0100.00716.82
7.4.10.0100.00715.24
7.4.00.0040.01214.84
7.3.330.0000.00713.35
7.3.320.0050.00013.20
7.3.310.0030.00516.42
7.3.300.0040.00416.26
7.3.290.0070.01116.32
7.3.280.0080.00916.39
7.3.270.0080.01117.40
7.3.260.0120.01216.61
7.3.250.0090.01116.39
7.3.240.0070.01016.29
7.3.230.0080.00816.47
7.3.210.0110.00616.31
7.3.200.0180.00319.39
7.3.190.0090.01616.46
7.3.180.0090.00616.37
7.3.170.0130.00316.45
7.3.160.0060.00916.52
7.3.130.0120.00614.64
7.3.120.0050.01114.84
7.3.110.0060.01114.48
7.3.100.0100.00315.00
7.3.90.0070.01014.77
7.3.80.0060.00615.02
7.3.70.0040.01114.53
7.3.60.0000.01614.73
7.3.50.0000.01414.84
7.3.40.0000.01414.68
7.3.30.0030.00714.93
7.3.20.0060.00616.46
7.3.10.0090.00316.36
7.3.00.0020.01516.45
7.2.330.0100.00716.43
7.2.320.0120.00616.77
7.2.310.0060.01216.68
7.2.300.0120.00616.71
7.2.290.0120.00616.47
7.2.260.0120.00015.14
7.2.250.0070.01315.23
7.2.240.0030.01214.97
7.2.230.0040.00814.80
7.2.220.0070.01115.17
7.2.210.0030.01214.88
7.2.200.0070.00715.18
7.2.190.0090.00614.81
7.2.180.0030.01014.95
7.2.170.0030.01314.95
7.2.160.0110.00415.04
7.2.150.0040.00816.92
7.2.140.0030.00617.12
7.2.130.0080.00716.83
7.2.120.0090.00516.90
7.2.110.0100.00316.90
7.2.100.0090.00616.78
7.2.90.0100.00616.92
7.2.80.0050.00916.91
7.2.70.0070.00517.05
7.2.60.0090.00516.77
7.2.50.0050.00916.78
7.2.40.0080.00516.86
7.2.30.0050.00816.86
7.2.20.0060.00716.90
7.2.10.0050.01016.95
7.2.00.0030.01216.65
7.1.330.0070.00715.77
7.1.320.0070.01015.68
7.1.310.0000.01215.86
7.1.300.0040.00815.86
7.1.290.0000.00915.88
7.1.280.0040.00415.61
7.1.270.0070.00715.63
7.1.260.0030.00915.61
7.1.250.0060.00615.70
7.1.240.0080.00415.86
7.1.230.0060.00615.44
7.1.220.0030.00915.71
7.1.210.0070.01315.82
7.1.200.0060.00815.71
7.1.190.0000.01115.72
7.1.180.0060.00615.48
7.1.170.0100.00315.49
7.1.160.0030.00915.95
7.1.150.0060.00615.97
7.1.140.0000.01615.90
7.1.130.0030.00815.63
7.1.120.0090.00315.70
7.1.110.0090.00615.96
7.1.100.0000.00915.86
7.1.90.0060.00615.65
7.1.80.0060.00615.66
7.1.70.0050.00916.39
7.1.60.0030.00917.61
7.1.50.0050.00816.36
7.1.40.0070.00715.69
7.1.30.0030.01115.83
7.1.20.0070.00315.64
7.1.10.0040.00415.64
7.1.00.0030.04119.12
7.0.330.0060.00615.48
7.0.320.0060.00815.47
7.0.310.0060.00515.34
7.0.300.0040.01115.36
7.0.290.0000.01115.20
7.0.280.0070.00415.36
7.0.270.0050.00315.38
7.0.260.0100.00315.11
7.0.250.0100.00315.23
7.0.240.0000.00815.41
7.0.230.0030.00615.29
7.0.220.0100.00315.48
7.0.210.0000.01015.56
7.0.200.0080.00316.18
7.0.190.0040.00815.55
7.0.180.0110.00415.32
7.0.170.0070.00715.57
7.0.160.0040.01115.50
7.0.150.0040.00715.26
7.0.140.0030.04118.81
7.0.130.0030.00615.46
7.0.120.0030.01015.40
7.0.110.0090.00315.53
7.0.100.0110.00415.52
7.0.90.0120.00015.33
7.0.80.0050.00515.49
7.0.70.0060.01015.48
7.0.60.0080.04517.64
7.0.50.0080.02016.73
7.0.40.0100.04516.83
7.0.30.0200.03916.85
7.0.20.0180.04216.88
7.0.10.0100.02416.82
7.0.00.0090.04016.82
5.6.400.0040.01114.53
5.6.390.0120.00314.38
5.6.380.0070.00714.35
5.6.370.0000.01414.60
5.6.360.0080.00314.66
5.6.350.0040.00414.16
5.6.340.0060.01013.99
5.6.330.0000.01114.11
5.6.320.0060.00314.42
5.6.310.0100.00314.13
5.6.300.0030.01014.15
5.6.290.0070.00314.27
5.6.280.0060.04017.72
5.6.270.0070.00714.47
5.6.260.0030.00914.21
5.6.250.0070.00714.09
5.6.240.0040.01114.26
5.6.230.0070.00414.66
5.6.220.0080.00614.24
5.6.210.0070.03917.42
5.6.200.0010.02716.29
5.6.190.0100.04517.25
5.6.180.0150.04217.45
5.6.170.0170.04517.51
5.6.160.0100.03317.34
5.6.150.0080.03616.33
5.6.140.0050.02416.26
5.6.130.0060.02516.30
5.6.120.0050.03017.62
5.6.110.0060.02617.61
5.6.100.0080.02817.70
5.6.90.0050.02317.52
5.6.80.0100.04017.43
5.6.70.0170.02917.27
5.6.60.0060.00314.04
5.6.50.0080.00414.33
5.6.40.0070.00714.06
5.6.30.0070.00714.44
5.6.20.0090.00614.35
5.6.10.0000.00814.20
5.6.00.0060.00914.29
5.5.380.0030.00613.97
5.5.370.0070.01013.99
5.5.360.0030.01114.08
5.5.350.0080.04017.28
5.5.340.0080.02316.21
5.5.330.0030.03117.12
5.5.320.0140.02017.17
5.5.310.0210.02517.47
5.5.300.0030.05016.09
5.5.290.0070.02816.22
5.5.280.0060.02117.57
5.5.270.0000.03917.47
5.5.260.0070.04517.55
5.5.250.0070.02317.46
5.5.240.0030.04617.30
5.5.230.0070.01014.18
5.5.220.0090.00614.20
5.5.210.0070.00713.94
5.5.200.0070.00714.53
5.5.190.0080.00614.19
5.5.180.0040.00814.22
5.5.170.0060.00614.11
5.5.160.0060.00614.31
5.5.150.0070.00314.48
5.5.140.0000.01114.32
5.5.130.0040.01114.40
5.5.120.0080.00514.08
5.5.110.0080.00413.91
5.5.100.0030.01314.39
5.5.90.0040.01113.89
5.5.80.0070.00714.15
5.5.70.0090.00014.36
5.5.60.0070.00714.07
5.5.50.0030.01414.12
5.5.40.0040.00814.21
5.5.30.0060.00614.07
5.5.20.0120.00414.24
5.5.10.0100.00314.41
5.5.00.0090.00613.81
5.4.450.0080.03015.68
5.4.440.0080.02315.60
5.4.430.0140.02515.68
5.4.420.0150.02315.72
5.4.410.0120.03515.70
5.4.400.0130.02615.53
5.4.390.0130.03315.55
5.4.380.0130.03215.49
5.4.370.0150.03315.52
5.4.360.0180.02815.51
5.4.350.0170.03815.45
5.4.340.0180.03515.37
5.4.330.0000.01211.89
5.4.320.0120.02715.52
5.4.310.0100.03915.44
5.4.300.0150.04215.45
5.4.290.0070.04615.52
5.4.280.0100.04415.43
5.4.270.0120.03815.51
5.4.260.0170.02815.55
5.4.250.0150.03815.44
5.4.240.0130.03215.43
5.4.230.0120.04015.53
5.4.220.0130.03715.37
5.4.210.0080.04015.60
5.4.200.0100.03915.55
5.4.190.0120.02815.55
5.4.180.0130.03815.46
5.4.170.0150.02515.54
5.4.160.0100.02615.53
5.4.150.0150.03615.48
5.4.140.0120.03214.15
5.4.130.0150.03314.24
5.4.120.0150.03214.12
5.4.110.0120.03914.24
5.4.100.0100.03914.15
5.4.90.0140.03214.25
5.4.80.0170.03714.15
5.4.70.0130.03714.25
5.4.60.0130.03014.07
5.4.50.0080.03014.12
5.4.40.0080.02614.17
5.4.30.0120.02714.11
5.4.20.0130.02614.11
5.4.10.0190.03514.16
5.4.00.0120.04113.83
5.3.290.0160.03813.27
5.3.280.0080.04113.29
5.3.270.0110.02813.21
5.3.260.0100.03213.26
5.3.250.0100.04513.24
5.3.240.0150.02613.25
5.3.230.0150.03413.21
5.3.220.0120.03013.24
5.3.210.0150.03113.23
5.3.200.0070.04513.28
5.3.190.0120.02813.19
5.3.180.0150.04013.21
5.3.170.0190.03713.31
5.3.160.0150.03913.22
5.3.150.0140.02613.29
5.3.140.0160.03713.19
5.3.130.0170.03513.26
5.3.120.0150.02913.25
5.3.110.0120.03613.23
5.3.100.0140.04112.93
5.3.90.0150.03812.91
5.3.80.0160.03612.95
5.3.70.0100.04313.04
5.3.60.0110.04112.95
5.3.50.0090.02912.87
5.3.40.0150.02712.88
5.3.30.0130.03612.92
5.3.20.0200.03412.75
5.3.10.0120.02712.78
5.3.00.0070.02612.85
5.2.170.0230.06012.20
5.2.160.0270.05312.20
5.2.150.0170.06012.20
5.2.140.0170.04712.20
5.2.130.0100.03312.20
5.2.120.0330.04712.20
5.2.110.0170.04012.20
5.2.100.0230.03712.20
5.2.90.0130.06012.20
5.2.80.0200.06012.20
5.2.70.0270.05312.20
5.2.60.0170.04712.20
5.2.50.0170.05712.20
5.2.40.0170.03312.20
5.2.30.0130.04012.20
5.2.20.0200.03012.20
5.2.10.0270.05012.20
5.2.00.0130.05712.20
5.1.60.0130.05712.20
5.1.50.0170.05012.20
5.1.40.0230.03312.20
5.1.30.0200.03712.20
5.1.20.0200.05312.20
5.1.10.0100.05012.20
5.1.00.0130.04712.20
5.0.50.0100.03012.20
5.0.40.0100.03012.20
5.0.30.0100.06712.20
5.0.20.0030.04312.20
5.0.10.0070.04312.20
5.0.00.0100.03012.20
4.4.90.0100.03312.20
4.4.80.0170.02712.20
4.4.70.0100.03312.20
4.4.60.0100.03712.20
4.4.50.0100.01712.20
4.4.40.0100.03312.20
4.4.30.0100.02012.20
4.4.20.0130.03012.20
4.4.10.0100.03012.20
4.4.00.0030.04712.20
4.3.110.0030.03012.20
4.3.100.0100.02712.20
4.3.90.0070.02712.20
4.3.80.0100.03312.20
4.3.70.0130.01712.20
4.3.60.0030.03312.20
4.3.50.0070.03012.20
4.3.40.0030.05712.20
4.3.30.0100.03312.20
4.3.20.0030.03712.20
4.3.10.0000.04012.20
4.3.00.0070.03312.20

preferences:
81.23 ms | 401 KiB | 5 Q