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 $answerTime = Closure::bindTo($this->getPrivate($that)); var_dump($answerTime); } public function getPrivate($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.40.0100.00718.63
8.3.30.0110.00419.27
8.3.20.0040.00420.21
8.3.10.0050.00323.66
8.3.00.0080.00019.25
8.2.170.0160.00322.96
8.2.160.0150.00020.38
8.2.150.0040.00424.18
8.2.140.0030.00624.66
8.2.130.0150.00326.16
8.2.120.0070.00022.08
8.2.110.0040.00421.98
8.2.100.0090.00317.72
8.2.90.0000.00719.27
8.2.80.0000.00817.97
8.2.70.0120.00017.38
8.2.60.0050.00317.80
8.2.50.0040.00418.07
8.2.40.0060.00319.89
8.2.30.0040.00418.08
8.2.20.0040.00417.63
8.2.10.0040.00417.99
8.2.00.0030.00717.76
8.1.270.0070.00423.99
8.1.260.0080.00026.35
8.1.250.0070.00728.09
8.1.240.0040.00423.79
8.1.230.0070.00418.79
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0060.00317.38
8.1.190.0040.00417.51
8.1.180.0030.00618.10
8.1.170.0050.00518.50
8.1.160.0000.00721.97
8.1.150.0110.00018.67
8.1.140.0050.00217.39
8.1.130.0030.00317.89
8.1.120.0040.00417.46
8.1.110.0050.00317.47
8.1.100.0070.00317.55
8.1.90.0000.00717.43
8.1.80.0040.00417.44
8.1.70.0080.00017.44
8.1.60.0030.00617.58
8.1.50.0000.00817.43
8.1.40.0040.00417.53
8.1.30.0030.00517.59
8.1.20.0040.00417.65
8.1.10.0060.00317.48
8.1.00.0030.00617.51
8.0.300.0050.00220.64
8.0.290.0050.00317.02
8.0.280.0000.00718.41
8.0.270.0000.00717.24
8.0.260.0080.00017.22
8.0.250.0000.00716.86
8.0.240.0000.00816.98
8.0.230.0000.00716.96
8.0.220.0040.00416.91
8.0.210.0000.00716.81
8.0.200.0040.00416.98
8.0.190.0040.00417.03
8.0.180.0040.00716.90
8.0.170.0050.00316.83
8.0.160.0040.00416.98
8.0.150.0050.00216.88
8.0.140.0040.00416.94
8.0.130.0000.00613.38
8.0.120.0030.00516.91
8.0.110.0000.00817.02
8.0.100.0070.00016.86
8.0.90.0040.00416.80
8.0.80.0030.01616.93
8.0.70.0050.00216.97
8.0.60.0080.00017.02
8.0.50.0040.00416.95
8.0.30.0160.00216.91
8.0.20.0120.00717.40
8.0.10.0050.00217.16
8.0.00.0100.00716.72
7.4.330.0000.00515.00
7.4.320.0050.00216.45
7.4.300.0070.00016.61
7.4.290.0030.00316.62
7.4.280.0060.00316.64
7.4.270.0000.00716.53
7.4.260.0030.00316.44
7.4.250.0040.00416.53
7.4.240.0050.00216.59
7.4.230.0030.00316.69
7.4.220.0070.01116.55
7.4.210.0070.01016.65
7.4.200.0040.00416.43
7.4.190.0000.00716.69
7.4.160.0100.00616.61
7.4.150.0070.01017.40
7.4.140.0070.01017.86
7.4.130.0120.00616.59
7.4.120.0120.00816.45
7.4.110.0030.01316.41
7.4.100.0030.01916.43
7.4.90.0060.01216.41
7.4.80.0160.00719.39
7.4.70.0130.00316.63
7.4.60.0070.01416.59
7.4.50.0050.00316.41
7.4.40.0090.00622.77
7.4.30.0060.00916.50
7.4.10.0030.01215.10
7.4.00.0070.01115.10
7.3.330.0030.00313.35
7.3.320.0030.00313.34
7.3.310.0070.00016.51
7.3.300.0000.00816.25
7.3.290.0140.00016.39
7.3.280.0080.00816.34
7.3.270.0150.00617.40
7.3.260.0140.01016.43
7.3.250.0060.01116.46
7.3.240.0000.01716.44
7.3.230.0060.01216.42
7.3.210.0060.01216.58
7.3.200.0100.01019.39
7.3.190.0070.01016.49
7.3.180.0060.01016.43
7.3.170.0030.01216.46
7.3.160.0110.00416.44
7.3.130.0060.01214.93
7.3.120.0090.00914.83
7.3.110.0100.00814.83
7.3.100.0070.00814.79
7.3.90.0090.00514.93
7.3.80.0050.00714.83
7.3.70.0070.00514.75
7.3.60.0060.00814.68
7.3.50.0040.01214.84
7.3.40.0060.00814.72
7.3.30.0020.01214.91
7.3.20.0040.00916.75
7.3.10.0040.01116.60
7.3.00.0050.00716.57
7.2.330.0130.00416.63
7.2.320.0120.00616.70
7.2.310.0110.00616.78
7.2.300.0100.01016.39
7.2.290.0060.01116.79
7.2.260.0090.00914.91
7.2.250.0050.01214.89
7.2.240.0060.01215.17
7.2.230.0100.00515.12
7.2.220.0050.00915.14
7.2.210.0030.01214.96
7.2.200.0040.00815.06
7.2.190.0100.00514.94
7.2.180.0030.01214.96
7.2.170.0010.00915.06
7.2.160.0060.00914.79
7.2.150.0090.00616.93
7.2.140.0100.01016.52
7.2.130.0060.00616.88
7.2.120.0070.00416.66
7.2.110.0070.00816.92
7.2.100.0070.01016.85
7.2.90.0040.00816.93
7.2.80.0050.00816.88
7.2.70.0060.00816.94
7.2.60.0100.00516.94
7.2.50.0080.00616.83
7.2.40.0060.00816.96
7.2.30.0040.00916.92
7.2.20.0100.00516.93
7.2.10.0080.00816.92
7.2.00.0080.00516.76
7.1.330.0090.00615.83
7.1.320.0030.00815.58
7.1.310.0010.01215.76
7.1.300.0060.00915.64
7.1.290.0090.00215.82
7.1.280.0040.01015.66
7.1.270.0090.00315.65
7.1.260.0060.00915.72
7.1.250.0060.00815.70
7.1.240.0040.00815.61
7.1.230.0030.01215.79
7.1.220.0060.00815.59
7.1.210.0080.00615.63
7.1.200.0070.00615.55
7.1.190.0120.00515.78
7.1.180.0100.00615.47
7.1.170.0060.00815.46
7.1.160.0040.00815.76
7.1.150.0100.00415.69
7.1.140.0080.00315.66
7.1.130.0080.00815.81
7.1.120.0040.00715.38
7.1.110.0080.00815.43
7.1.100.0060.01015.77
7.1.90.0090.00415.73
7.1.80.0100.00715.78
7.1.70.0060.00516.20
7.1.60.0070.01016.90
7.1.50.0080.01116.06
7.1.40.0090.00415.50
7.1.30.0120.00215.69
7.1.20.0080.00715.71
7.1.10.0050.00915.72
7.1.00.0100.02817.96
7.0.330.0110.00615.18
7.0.320.0060.00815.45
7.0.310.0070.00815.49
7.0.300.0070.00515.44
7.0.290.0070.01015.37
7.0.280.0080.00415.36
7.0.270.0120.00315.36
7.0.260.0070.00815.41
7.0.250.0050.00915.55
7.0.240.0060.00615.32
7.0.230.0080.01015.37
7.0.220.0080.00615.40
7.0.210.0080.00615.37
7.0.200.0060.01115.74
7.0.190.0080.00715.38
7.0.180.0060.00715.38
7.0.170.0030.01015.37
7.0.160.0080.00815.30
7.0.150.0090.00715.50
7.0.140.0060.02617.61
7.0.130.0100.00515.34
7.0.120.0090.00715.36
7.0.110.0070.00715.23
7.0.100.0070.00515.45
7.0.90.0080.00715.18
7.0.80.0100.00815.12
7.0.70.0090.00815.30
7.0.60.0040.03516.89
7.0.50.0090.03116.21
7.0.40.0080.02915.57
7.0.30.0130.01415.63
7.0.20.0120.02015.61
7.0.10.0070.03415.67
7.0.00.0060.03515.58
5.6.400.0090.00014.13
5.6.390.0090.00013.97
5.6.380.0040.00914.27
5.6.370.0080.00614.42
5.6.360.0080.00414.33
5.6.350.0070.00414.25
5.6.340.0050.00814.37
5.6.330.0120.00314.38
5.6.320.0060.00614.19
5.6.310.0080.00714.22
5.6.300.0110.00314.25
5.6.290.0100.00614.29
5.6.280.0060.03116.55
5.6.270.0090.00814.30
5.6.260.0110.00414.31
5.6.250.0020.01114.07
5.6.240.0040.01014.37
5.6.230.0130.00514.41
5.6.220.0110.00814.32
5.6.210.0110.02616.36
5.6.200.0100.01515.50
5.6.190.0070.02216.24
5.6.180.0120.03016.36
5.6.170.0160.03016.13
5.6.160.0040.02516.32
5.6.150.0030.02115.48
5.6.140.0050.02215.50
5.6.130.0060.03515.68
5.6.120.0050.03016.44
5.6.110.0060.03116.38
5.6.100.0070.03316.38
5.6.90.0070.03616.41
5.6.80.0080.02416.06
5.6.70.1570.01416.19
5.6.60.0030.01014.08
5.6.50.0030.00914.11
5.6.40.0070.00714.17
5.6.30.0050.00714.18
5.6.20.0070.00914.26
5.6.10.0080.00514.25
5.6.00.0070.00614.16
5.5.380.0100.00512.51
5.5.370.0070.00412.51
5.5.360.0090.00512.45
5.5.350.0080.03715.44
5.5.340.0020.03014.36
5.5.330.0090.03015.11
5.5.320.0180.02315.26
5.5.310.0100.03215.07
5.5.300.0050.01614.44
5.5.290.0050.03114.29
5.5.280.0080.02115.24
5.5.270.0040.02015.25
5.5.260.0050.03515.30
5.5.250.0040.01915.18
5.5.240.1260.01715.23
5.5.230.0080.00412.64
5.5.220.0020.00812.56
5.5.210.0050.00912.51
5.5.200.0050.00612.62
5.5.190.0020.01112.36
5.5.180.0060.00312.53
5.5.170.0030.01212.54
5.5.160.0090.00512.77
5.5.150.0090.00412.72
5.5.140.0060.00412.77
5.5.130.0040.00412.76
5.5.120.0060.00712.44
5.5.110.0020.00612.59
5.5.100.0030.00812.57
5.5.90.0030.00912.73
5.5.80.0070.00512.44
5.5.70.0060.00412.79
5.5.60.0030.00912.32
5.5.50.0080.00512.49
5.5.40.0070.00712.69
5.5.30.0060.00712.47
5.5.20.0050.00512.45
5.5.10.0050.01012.53
5.5.00.0020.00912.62
5.4.450.0270.02713.78
5.4.440.0340.02313.78
5.4.430.0180.02013.92
5.4.420.0050.02513.74
5.4.410.0280.02113.94
5.4.400.0050.02213.67
5.4.390.0210.02613.67
5.4.380.0220.02413.40
5.4.370.0130.02613.51
5.4.360.0160.02013.55
5.4.350.0110.02313.57
5.4.340.0090.02913.44
5.4.330.0110.00010.89
5.4.320.0060.01611.51
5.4.310.0050.02011.47
5.4.300.0060.01711.28
5.4.290.0020.02111.44
5.4.280.0070.01611.31
5.4.270.0040.01711.26
5.4.260.0040.01711.41
5.4.250.0050.01711.50
5.4.240.0080.01411.30
5.4.230.0050.01911.22
5.4.220.0050.02311.21
5.4.210.0060.02611.28
5.4.200.0040.01711.35
5.4.190.0060.01911.42
5.4.180.0030.02511.27
5.4.170.0060.02111.34
5.4.160.0050.02111.32
5.4.150.0050.02311.43
5.4.140.0060.03011.25
5.4.130.0070.03011.32
5.4.120.0090.02311.36
5.4.110.0040.02311.34
5.4.100.0060.02011.27
5.4.90.0060.02511.35
5.4.80.0090.02011.38
5.4.70.0080.02211.38
5.4.60.0080.02411.37
5.4.50.0080.02511.40
5.4.40.0050.02011.32
5.4.30.0040.01911.35
5.4.20.0050.01711.23
5.4.10.0050.01611.25
5.4.00.0060.01511.07
5.3.290.0050.01911.42
5.3.280.0050.01611.28
5.3.270.0060.01611.24
5.3.260.0070.01811.32
5.3.250.0070.01411.30
5.3.240.0080.01711.21
5.3.230.0060.02411.27
5.3.220.0060.01811.29
5.3.210.0030.02011.20
5.3.200.0070.01511.27
5.3.190.0050.01811.27
5.3.180.0060.01611.32
5.3.170.0080.02111.35
5.3.160.0090.02211.37
5.3.150.0100.02811.32
5.3.140.0070.03011.34
5.3.130.0060.02311.32
5.3.120.0040.02411.36
5.3.110.0050.02211.28
5.3.100.0060.01811.01
5.3.90.0030.02211.10
5.3.80.0030.01911.05
5.3.70.0070.01811.06
5.3.60.0050.01610.99
5.3.50.0070.02011.05
5.3.40.0040.02111.05
5.3.30.0050.01911.03
5.3.20.0060.01710.90
5.3.10.0060.01710.86
5.3.00.0020.01810.80
5.2.170.0050.0259.45
5.2.160.0020.0239.32
5.2.150.0060.0279.37
5.2.140.0060.0239.40
5.2.130.0030.0219.38
5.2.120.0040.0239.30
5.2.110.0090.0209.31
5.2.100.0040.0259.30
5.2.90.0030.0279.39
5.2.80.0040.0279.33
5.2.70.0040.0369.30
5.2.60.0060.0169.30
5.2.50.0040.0199.33
5.2.40.0040.0189.31
5.2.30.0050.0209.28
5.2.20.0040.0179.23
5.2.10.0060.0199.19
5.2.00.0040.0239.12
5.1.60.0030.0178.76
5.1.50.0060.0148.75
5.1.40.0050.0138.75
5.1.30.0040.0228.92
5.1.20.0040.0238.93
5.1.10.0050.0198.79
5.1.00.0070.0168.79
5.0.50.0020.0188.04
5.0.40.0060.0177.96
5.0.30.0030.0197.87
5.0.20.0050.0117.86
5.0.10.0060.0097.84
5.0.00.0010.0227.84
4.4.90.0020.0117.10
4.4.80.0030.0107.09
4.4.70.0030.0117.08
4.4.60.0040.0097.08
4.4.50.0040.0097.09
4.4.40.0020.0167.06
4.4.30.0050.0077.09
4.4.20.0060.0157.13
4.4.10.0050.0137.13
4.4.00.0040.0207.09
4.3.110.0010.0157.04
4.3.100.0020.0197.04
4.3.90.0030.0147.03
4.3.80.0050.0237.00
4.3.70.0040.0127.02
4.3.60.0050.0137.02
4.3.50.0050.0097.02
4.3.40.0020.0206.97
4.3.30.0050.0136.36
4.3.20.0040.0106.35
4.3.10.0010.0146.33
4.3.00.0090.0129.97

preferences:
43.88 ms | 400 KiB | 5 Q