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($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.0060.00916.75
8.3.50.0100.01021.99
8.3.40.0110.00618.62
8.3.30.0070.00718.84
8.3.20.0040.00420.33
8.3.10.0070.00723.48
8.3.00.0000.00819.25
8.2.180.0090.00918.41
8.2.170.0080.00622.96
8.2.160.0140.00020.49
8.2.150.0050.00324.18
8.2.140.0060.01324.66
8.2.130.0070.01026.16
8.2.120.0040.00422.21
8.2.110.0030.00622.30
8.2.100.0110.00017.91
8.2.90.0040.00418.80
8.2.80.0060.00317.97
8.2.70.0090.00517.25
8.2.60.0040.00417.80
8.2.50.0060.00318.07
8.2.40.0080.00019.75
8.2.30.0060.00318.03
8.2.20.0000.00717.64
8.2.10.0070.00018.07
8.2.00.0070.00317.75
8.1.280.0140.00425.92
8.1.270.0090.00023.98
8.1.260.0030.00626.35
8.1.250.0040.00428.09
8.1.240.0060.00324.02
8.1.230.0070.00419.00
8.1.220.0030.00617.74
8.1.210.0060.00318.77
8.1.200.0060.00317.35
8.1.190.0040.00417.55
8.1.180.0070.00318.10
8.1.170.0030.00618.63
8.1.160.0040.00422.11
8.1.150.0060.00318.58
8.1.140.0000.00717.36
8.1.130.0070.00017.80
8.1.120.0000.00817.49
8.1.110.0040.00417.54
8.1.100.0000.00917.43
8.1.90.0000.00717.48
8.1.80.0000.00817.48
8.1.70.0030.00317.51
8.1.60.0040.00417.63
8.1.50.0030.00517.47
8.1.40.0050.00317.60
8.1.30.0080.00017.59
8.1.20.0040.00417.57
8.1.10.0000.00917.60
8.1.00.0070.00017.57
8.0.300.0000.00720.71
8.0.290.0040.00416.91
8.0.280.0040.00418.34
8.0.270.0030.00317.10
8.0.260.0000.00817.10
8.0.250.0070.00016.97
8.0.240.0040.00416.95
8.0.230.0040.00316.99
8.0.220.0030.00416.89
8.0.210.0030.00316.94
8.0.200.0030.00316.87
8.0.190.0060.00316.99
8.0.180.0070.00416.95
8.0.170.0040.00416.83
8.0.160.0000.00716.95
8.0.150.0000.00816.84
8.0.140.0040.00416.98
8.0.130.0000.00613.45
8.0.120.0000.00816.93
8.0.110.0040.00416.88
8.0.100.0030.00517.04
8.0.90.0070.00016.99
8.0.80.0130.00616.98
8.0.70.0040.00416.82
8.0.60.0040.00416.89
8.0.50.0030.00416.88
8.0.30.0100.00717.03
8.0.20.0070.01117.40
8.0.10.0040.00417.10
8.0.00.0070.01316.84
7.4.330.0000.00515.00
7.4.320.0030.00316.54
7.4.300.0070.00016.58
7.4.290.0040.00416.44
7.4.280.0050.00316.47
7.4.270.0000.00716.66
7.4.260.0030.00316.66
7.4.250.0040.00416.42
7.4.240.0040.00416.54
7.4.230.0000.00816.66
7.4.220.0070.01116.56
7.4.210.0070.00916.58
7.4.200.0030.00316.73
7.4.190.0070.00016.57
7.4.160.0120.00416.41
7.4.150.0060.01317.40
7.4.140.0100.00817.86
7.4.130.0070.01016.58
7.4.120.0120.00616.65
7.4.110.0030.01316.71
7.4.100.0110.01116.74
7.4.90.0320.03816.61
7.4.80.0120.01519.39
7.4.70.0100.01016.47
7.4.60.0100.00716.61
7.4.50.0000.00916.39
7.4.40.0100.00722.77
7.4.30.0100.00716.78
7.4.10.0100.00914.95
7.4.00.0050.01114.90
7.3.330.0030.00313.43
7.3.320.0000.00513.30
7.3.310.0040.00416.26
7.3.300.0040.00416.25
7.3.290.0000.01316.39
7.3.280.0110.00916.37
7.3.270.0140.00717.40
7.3.260.0120.00616.37
7.3.250.0090.00916.50
7.3.240.0100.00716.47
7.3.230.0130.00316.39
7.3.210.0070.01016.64
7.3.200.0060.01419.39
7.3.190.0160.00616.46
7.3.180.0110.00516.46
7.3.170.0030.01316.46
7.3.160.0060.01116.49
7.3.130.0050.01214.88
7.3.120.0050.01014.83
7.3.110.0080.00814.79
7.3.100.0040.00914.81
7.3.90.0060.00914.71
7.3.80.0090.00414.91
7.3.70.0050.00814.81
7.3.60.0050.01114.73
7.3.50.0030.01014.87
7.3.40.0040.01114.68
7.3.30.0070.00914.76
7.3.20.0060.00716.64
7.3.10.0030.01016.54
7.3.00.0070.00916.50
7.2.330.0120.00616.71
7.2.320.0120.00416.77
7.2.310.0130.01016.52
7.2.300.0090.00616.63
7.2.290.0060.01016.81
7.2.260.0080.00914.84
7.2.250.0080.00714.90
7.2.240.0090.00514.81
7.2.230.0060.00915.26
7.2.220.0050.01014.95
7.2.210.0060.01014.93
7.2.200.0080.00614.95
7.2.190.0120.00214.96
7.2.180.0070.00715.02
7.2.170.0060.00915.10
7.2.160.0030.00814.98
7.2.150.0020.01316.88
7.2.140.0050.01116.91
7.2.130.0080.00716.79
7.2.120.0090.00616.83
7.2.110.0020.01016.81
7.2.100.0020.01016.69
7.2.90.0080.00816.93
7.2.80.0000.01116.91
7.2.70.0030.01016.91
7.2.60.0070.00816.84
7.2.50.0040.01116.96
7.2.40.0050.00816.76
7.2.30.0020.01516.89
7.2.20.0070.00616.91
7.2.10.0080.00616.89
7.2.00.0060.00717.63
7.1.330.0030.01015.88
7.1.320.0030.01215.57
7.1.310.0060.00715.78
7.1.300.0030.01015.72
7.1.290.0030.01015.78
7.1.280.0030.00815.73
7.1.270.0050.00515.64
7.1.260.0080.01015.78
7.1.250.0090.00615.68
7.1.240.0060.00815.60
7.1.230.0080.00615.88
7.1.220.0070.00415.59
7.1.210.0050.00915.78
7.1.200.0090.00315.81
7.1.190.0050.01015.70
7.1.180.0050.01115.76
7.1.170.0100.00715.65
7.1.160.0050.00715.59
7.1.150.0050.00615.78
7.1.140.0070.00715.70
7.1.130.0030.01015.66
7.1.120.0070.00715.77
7.1.110.0050.00715.61
7.1.100.0070.00816.70
7.1.90.0030.01215.78
7.1.80.0070.00815.59
7.1.70.0060.00416.21
7.1.60.0040.01116.94
7.1.50.0050.01116.14
7.1.40.0050.00515.66
7.1.30.0050.00615.76
7.1.20.0070.00915.72
7.1.10.0080.00415.81
7.1.00.0060.02917.94
7.0.330.0030.00915.31
7.0.320.0060.00615.34
7.0.310.0090.00515.35
7.0.300.0040.01015.41
7.0.290.0090.00515.26
7.0.280.0060.00615.46
7.0.270.0070.00415.34
7.0.260.0030.01015.37
7.0.250.0050.00715.44
7.0.240.0040.00715.32
7.0.230.0060.00515.39
7.0.220.0030.01015.38
7.0.210.0050.00715.38
7.0.200.0060.00415.76
7.0.190.0060.00415.42
7.0.180.0050.00915.41
7.0.170.0050.00415.27
7.0.160.0070.01015.53
7.0.150.0080.00515.35
7.0.140.0020.03017.67
7.0.130.0020.01115.46
7.0.120.0040.01115.46
7.0.110.0070.00515.27
7.0.100.0050.01816.98
7.0.90.0030.02016.91
7.0.80.0060.01817.02
7.0.70.0070.01516.94
7.0.60.0070.01316.90
7.0.50.0060.01517.08
7.0.40.0020.02115.72
7.0.30.0050.01715.79
7.0.20.0060.02115.72
7.0.10.0040.02415.77
7.0.00.0040.02415.79
5.6.400.0040.01214.04
5.6.390.0050.00714.39
5.6.380.0050.00514.31
5.6.370.0060.00614.09
5.6.360.0060.00714.12
5.6.350.0040.00714.49
5.6.340.0080.00214.29
5.6.330.0040.01114.48
5.6.320.0070.00614.23
5.6.310.0110.00214.44
5.6.300.0100.00314.13
5.6.290.0100.00314.37
5.6.280.0090.02616.63
5.6.270.0020.00814.43
5.6.260.0050.00714.38
5.6.250.0060.01716.51
5.6.240.0030.02016.49
5.6.230.0080.01416.29
5.6.220.0040.02116.45
5.6.210.0050.02116.35
5.6.200.0060.02016.58
5.6.190.0040.01416.66
5.6.180.0050.02116.59
5.6.170.0080.01316.58
5.6.160.0060.03516.70
5.6.150.0030.03216.43
5.6.140.0020.04116.64
5.6.130.0100.02816.56
5.6.120.0060.03316.49
5.6.110.0060.03416.54
5.6.100.0070.02416.49
5.6.90.0090.03116.50
5.6.80.0090.01916.30
5.6.70.0090.02716.17
5.6.60.0110.02616.30
5.6.50.0080.01816.23
5.6.40.0100.02816.32
5.6.30.0040.02716.26
5.6.20.0080.03116.20
5.6.10.0050.03616.38
5.6.00.0080.03216.26
5.5.380.0040.01816.44
5.5.370.0080.01716.20
5.5.360.0050.02016.31
5.5.350.0060.01916.31
5.5.340.0060.01516.36
5.5.330.0050.01616.35
5.5.320.0040.02016.53
5.5.310.0070.02216.36
5.5.300.0060.03116.53
5.5.290.0060.03116.37
5.5.280.0110.02016.38
5.5.270.0050.02716.50
5.5.260.0100.02916.57
5.5.250.0070.02616.34
5.5.240.0060.01816.30
5.5.230.0060.03016.16
5.5.220.0070.02516.22
5.5.210.0060.03016.11
5.5.200.0040.03316.24
5.5.190.0040.03416.20
5.5.180.0090.02916.20
5.5.170.0050.00814.27
5.5.160.0090.02816.13
5.5.150.0040.02816.20
5.5.140.0080.02916.28
5.5.130.0050.03316.24
5.5.120.0060.02516.31
5.5.110.0080.02816.21
5.5.100.0070.02415.97
5.5.90.0040.03116.11
5.5.80.0030.02316.17
5.5.70.0050.03116.10
5.5.60.0070.03316.13
5.5.50.0060.02516.18
5.5.40.0090.02816.09
5.5.30.0050.02916.12
5.5.20.0050.02016.15
5.5.10.0070.03416.17
5.5.00.0080.02716.09
5.4.450.0100.02315.35
5.4.440.0050.02715.29
5.4.430.0070.02615.32
5.4.420.0070.02115.31
5.4.410.0070.02715.27
5.4.400.0050.03415.23
5.4.390.0060.02915.15
5.4.380.0030.02215.25
5.4.370.0070.02415.21
5.4.360.0010.03015.21
5.4.350.0040.03015.18
5.4.340.0070.02715.13
5.4.330.0050.00313.26
5.4.320.0050.02915.19
5.4.310.0080.02715.18
5.4.300.0070.03015.20
5.4.290.0050.01815.13
5.4.280.0020.03115.21
5.4.270.0050.02615.18
5.4.260.0060.01515.15
5.4.250.0040.02915.22
5.4.240.0070.01515.15
5.4.230.0030.03215.12
5.4.220.0070.02815.21
5.4.210.0040.02715.13
5.4.200.0030.02815.20
5.4.190.0040.03015.15
5.4.180.0070.03215.18
5.4.170.0090.01615.21
5.4.160.0040.02015.17
5.4.150.0040.02115.22
5.4.140.0030.03114.25
5.4.130.0050.02714.28
5.4.120.0030.01914.25
5.4.110.0090.01514.36
5.4.100.0060.02614.35
5.4.90.0050.01714.35
5.4.80.0070.02614.33
5.4.70.0010.03014.30
5.4.60.0050.03014.33
5.4.50.0030.02914.27
5.4.40.0070.02414.29
5.4.30.0050.02914.31
5.4.20.0080.02414.27
5.4.10.0040.02914.29
5.4.00.0040.02814.13
5.3.290.0040.03313.73
5.3.280.0040.01913.71
5.3.270.0060.02513.73
5.3.260.0060.02313.69
5.3.250.0030.02913.73
5.3.240.0050.02913.71
5.3.230.0060.03013.71
5.3.220.0110.02413.68
5.3.210.0100.02913.70
5.3.200.0080.02713.70
5.3.190.0060.02913.74
5.3.180.0070.01813.73
5.3.170.0080.01713.67
5.3.160.0050.02713.68
5.3.150.0080.01713.69
5.3.140.0060.02313.74
5.3.130.0050.02913.73
5.3.120.0040.02913.68
5.3.110.0060.01813.73
5.3.100.0070.03113.53
5.3.90.0030.01913.50
5.3.80.0040.01813.48
5.3.70.0040.01813.48
5.3.60.0030.02113.49
5.3.50.0020.02913.53
5.3.40.0050.03013.45
5.3.30.0030.03113.47
5.3.20.0070.01613.41
5.3.10.0020.03013.43
5.3.00.0050.01513.36
5.2.170.0070.05711.27
5.2.160.0000.06011.03
5.2.150.0070.06011.21
5.2.140.0030.05311.21
5.2.130.0030.06311.17
5.2.120.0070.05011.12
5.2.110.0030.04311.23
5.2.100.0030.06310.97
5.2.90.0070.06011.06
5.2.80.0030.06711.17
5.2.70.0030.06711.12
5.2.60.0070.05011.18
5.2.50.0030.06011.06
5.2.40.0030.04310.89
5.2.30.0070.06011.07
5.2.20.0030.06310.96
5.2.10.0030.03711.00
5.2.00.0030.06010.68
5.1.60.0030.05310.06
5.1.50.0100.04710.08
5.1.40.0000.0539.83
5.1.30.0070.02710.34
5.1.20.0030.03010.39
5.1.10.0100.05310.18
5.1.00.0100.05010.07
5.0.50.0070.0438.44
5.0.40.0030.0408.43
5.0.30.0030.0578.43
5.0.20.0130.0378.43
5.0.10.0030.0438.43
5.0.00.0070.0578.43
4.4.90.0000.0238.43
4.4.80.0000.0378.43
4.4.70.0000.0408.43
4.4.60.0030.0178.43
4.4.50.0000.0308.43
4.4.40.0030.0538.43
4.4.30.0000.0278.43
4.4.20.0000.0208.43
4.4.10.0000.0378.43
4.4.00.0000.0438.43
4.3.110.0000.0408.43
4.3.100.0030.0338.43
4.3.90.0000.0278.43
4.3.80.0030.0278.43
4.3.70.0030.0338.43
4.3.60.0000.0378.43
4.3.50.0070.0238.43
4.3.40.0000.0308.43
4.3.30.0030.0338.43
4.3.20.0000.0178.43
4.3.10.0030.0408.43
4.3.00.0000.0278.43

preferences:
42.81 ms | 401 KiB | 5 Q