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) { $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.0110.01118.50
8.3.50.0120.00821.94
8.3.40.0070.01018.93
8.3.30.0090.00619.04
8.3.20.0140.00420.21
8.3.10.0040.00423.53
8.3.00.0060.00319.26
8.2.180.0040.01118.41
8.2.170.0090.00622.96
8.2.160.0100.00320.38
8.2.150.0040.00424.18
8.2.140.0050.00224.66
8.2.130.0050.00326.16
8.2.120.0040.00422.31
8.2.110.0000.00920.47
8.2.100.0110.00017.78
8.2.90.0070.00319.07
8.2.80.0040.00417.97
8.2.70.0040.00417.50
8.2.60.0040.00417.80
8.2.50.0050.00318.07
8.2.40.0000.00919.76
8.2.30.0070.00017.86
8.2.20.0090.00017.60
8.2.10.0030.00518.06
8.2.00.0050.00317.63
8.1.280.0130.00325.92
8.1.270.0050.00323.76
8.1.260.0090.00026.35
8.1.250.0050.00228.09
8.1.240.0000.01022.55
8.1.230.0080.00320.95
8.1.220.0030.00617.74
8.1.210.0070.00020.20
8.1.200.0060.00317.35
8.1.190.0040.00417.52
8.1.180.0040.00718.10
8.1.170.0000.01018.69
8.1.160.0050.00221.99
8.1.150.0100.00018.71
8.1.140.0040.00417.38
8.1.130.0030.00317.75
8.1.120.0040.00417.48
8.1.110.0050.00217.37
8.1.100.0090.00017.48
8.1.90.0040.00417.45
8.1.80.0030.00317.49
8.1.70.0030.00317.51
8.1.60.0030.00517.61
8.1.50.0040.00417.50
8.1.40.0040.00417.44
8.1.30.0040.00417.56
8.1.20.0030.00617.62
8.1.10.0000.00717.46
8.1.00.0080.00017.44
8.0.300.0000.00719.91
8.0.290.0070.00017.15
8.0.280.0040.00218.27
8.0.270.0030.00317.14
8.0.260.0060.00018.30
8.0.250.0030.00316.95
8.0.240.0040.00416.97
8.0.230.0030.00316.94
8.0.220.0030.00316.90
8.0.210.0070.00016.92
8.0.200.0030.00316.90
8.0.190.0080.00016.99
8.0.180.0030.00716.82
8.0.170.0050.00316.94
8.0.160.0000.00716.97
8.0.150.0080.00016.84
8.0.140.0000.00716.82
8.0.130.0000.00713.41
8.0.120.0040.00416.94
8.0.110.0040.00316.98
8.0.100.0000.00816.86
8.0.90.0040.00416.98
8.0.80.0090.00916.97
8.0.70.0050.00216.78
8.0.60.0050.00316.99
8.0.50.0000.00717.01
8.0.30.0120.00717.09
8.0.20.0110.00717.40
8.0.10.0000.00717.13
8.0.00.0030.01416.68
7.4.330.0000.00515.00
7.4.320.0060.00016.57
7.4.300.0050.00216.56
7.4.290.0030.00316.62
7.4.280.0030.00316.42
7.4.270.0070.00016.52
7.4.260.0000.00716.52
7.4.250.0080.00016.48
7.4.240.0070.00016.51
7.4.230.0000.00716.63
7.4.220.0120.00616.64
7.4.210.0030.01216.52
7.4.200.0000.00816.50
7.4.190.0080.00016.70
7.4.160.0120.00416.61
7.4.150.0070.01017.40
7.4.140.0100.01017.86
7.4.130.0120.00616.52
7.4.120.0070.01216.63
7.4.110.0060.01016.63
7.4.100.0120.00616.43
7.4.90.0070.01016.57
7.4.80.0120.01219.39
7.4.70.0110.00816.54
7.4.60.0100.01016.52
7.4.50.0050.00016.66
7.4.40.0060.00922.77
7.4.30.0040.01616.46
7.4.00.0000.01514.75
7.3.330.0030.00313.37
7.3.320.0000.00613.38
7.3.310.0040.00416.22
7.3.300.0040.00416.23
7.3.290.0070.00616.44
7.3.280.0060.01016.35
7.3.270.0220.00317.40
7.3.260.0070.01016.55
7.3.250.0120.00716.44
7.3.240.0080.00816.47
7.3.230.0110.00816.51
7.3.210.0090.00916.49
7.3.200.0070.01019.39
7.3.190.0110.00916.48
7.3.180.0090.00616.41
7.3.170.0120.00416.46
7.3.160.0060.01016.59
7.3.120.0040.01414.84
7.2.330.0100.00716.63
7.2.320.0060.01416.68
7.2.310.0090.00916.61
7.2.300.0140.00416.78
7.2.290.0060.01116.42
7.2.60.0000.01416.88
7.2.00.0030.01219.44
7.1.200.0030.00615.86
7.1.100.0080.00818.27
7.1.70.0030.00617.08
7.1.60.0040.01419.46
7.1.50.0030.01916.96
7.1.00.0030.07722.36
7.0.200.0100.00016.81
7.0.140.0000.07722.12
7.0.60.0000.07719.95
7.0.50.0070.04717.99
7.0.40.0170.07320.18
7.0.30.0330.06020.11
7.0.20.0230.07320.19
7.0.10.0100.07020.09
7.0.00.0030.05720.08
5.6.280.0070.07021.12
5.6.210.0100.08020.77
5.6.200.0100.08018.12
5.6.190.0100.03720.60
5.6.180.0400.07020.63
5.6.170.0330.07320.55
5.6.160.0130.07720.41
5.6.150.0000.08318.29
5.6.140.0030.08718.13
5.6.130.0100.07018.20
5.6.120.0230.04020.92
5.6.110.0070.07020.97
5.6.100.0200.07320.94
5.6.90.0100.08021.08
5.6.80.0070.03720.39
5.5.350.0230.07720.45
5.5.340.0130.07317.99
5.5.330.0030.04020.25
5.5.320.0230.04020.27
5.5.310.0330.04320.50
5.5.300.0030.07017.95
5.5.290.0100.04317.93
5.5.280.0200.05020.97
5.5.270.0030.04720.77
5.5.260.0070.04320.80
5.5.250.0100.07720.70
5.5.240.0130.07020.16
5.4.450.0430.04719.17
5.4.440.0670.04719.18
5.4.430.0830.04019.16
5.4.420.0300.05019.48
5.4.410.0470.04319.35
5.4.400.0400.03018.98
5.4.390.0270.04719.24
5.4.380.0400.05718.52
5.4.370.0370.05718.72
5.4.360.0300.05018.57
5.4.350.0330.05018.59
5.4.340.0400.06718.78
5.4.320.0040.04012.51
5.4.310.0040.03912.50
5.4.300.0070.03512.51
5.4.290.0070.05412.48
5.4.280.0130.03512.38
5.4.270.0070.04312.39
5.4.260.0150.06112.38
5.4.250.0240.07912.38
5.4.240.0200.09012.38
5.4.230.0070.06412.38
5.4.220.0110.05212.38
5.4.210.0340.15712.38
5.4.200.0070.05412.38
5.4.190.0130.04912.37
5.4.180.0050.05012.37
5.4.170.0100.03812.38
5.4.160.0060.03712.38
5.4.150.0050.03812.38
5.4.140.0060.03912.06
5.4.130.0090.04712.05
5.4.120.0040.05512.01
5.4.110.0050.05412.00
5.4.100.0030.04112.00
5.4.90.0050.03812.00
5.4.80.0070.04212.00
5.4.70.0080.04712.00
5.4.60.0110.03812.00
5.4.50.0050.03812.00
5.4.40.0040.03911.98
5.4.30.0060.03611.98
5.4.20.0090.03211.98
5.4.10.0100.04811.98
5.4.00.0080.04511.48
5.3.290.0090.04312.80
5.3.280.0120.03512.71
5.3.270.0070.04612.73
5.3.260.0060.04512.72
5.3.250.0050.03912.72
5.3.240.0040.04112.72
5.3.230.0090.04712.71
5.3.220.0090.05012.68
5.3.210.0130.03812.68
5.3.200.0070.03912.68
5.3.190.0070.03812.68
5.3.180.0250.10912.68
5.3.170.0120.04712.67
5.3.160.0060.04712.67
5.3.150.0110.04612.67
5.3.140.0120.05012.66
5.3.130.0130.04312.66
5.3.120.0050.04312.66
5.3.110.0070.03912.66
5.3.100.0110.03912.13
5.3.90.0080.04012.11
5.3.80.0050.03612.10
5.3.70.0080.03412.10
5.3.60.0070.03512.09
5.3.50.0060.03712.03
5.3.40.0080.04012.04
5.3.30.0090.03211.99
5.3.20.0070.03411.78
5.3.10.0060.03411.74
5.3.00.0050.03711.73
5.2.170.0070.0289.23
5.2.160.0100.0249.23
5.2.150.0050.0329.23
5.2.140.0040.0329.23
5.2.130.0050.0309.18
5.2.120.0040.0319.18
5.2.110.0070.0339.19
5.2.100.0030.0379.19
5.2.90.0040.0449.20
5.2.80.0030.0379.19
5.2.70.0060.0439.19
5.2.60.0080.0439.14
5.2.50.0050.0439.11
5.2.40.0100.0409.09
5.2.30.0090.0349.06
5.2.20.0060.0389.05
5.2.10.0080.0278.95
5.2.00.0060.0348.82
5.1.60.0040.0368.10
5.1.50.0050.0268.10
5.1.40.0070.0348.08
5.1.30.0060.0288.43
5.1.20.0090.0448.45
5.1.10.0030.0398.18
5.1.00.0080.0368.18
5.0.50.0030.0256.65
5.0.40.0050.0196.51
5.0.30.0050.0316.32
5.0.20.0020.0246.29
5.0.10.0020.0226.27
5.0.00.0060.0536.26
4.4.90.0090.0274.78
4.4.80.0060.0184.75
4.4.70.0030.0194.76
4.4.60.0040.0214.76
4.4.50.0070.0274.77
4.4.40.0040.0354.70
4.4.30.0050.0214.76
4.4.20.0060.0174.85
4.4.10.0050.0204.85
4.4.00.0060.0254.76
4.3.110.0000.0274.67
4.3.100.0050.0214.66
4.3.90.0130.0234.63
4.3.80.0100.0584.59
4.3.70.0060.0224.63
4.3.60.0070.0224.63
4.3.50.0080.0214.63
4.3.40.0020.0294.54
4.3.30.0020.0173.30
4.3.20.0020.0173.28
4.3.10.0020.0153.24
4.3.00.0100.01713.47

preferences:
45.58 ms | 401 KiB | 5 Q