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 Answer extends Exception { public function getAnswer(Question $q) { $qReflect = new ReflectionClass($q); print_r ($qReflect->getProperties()[0]); return $q->answer; } } $e = new Answer; // 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.0130.00418.68
8.3.50.0140.00822.05
8.3.40.0000.01518.74
8.3.30.0030.01419.05
8.3.20.0040.00420.28
8.3.10.0000.00823.70
8.3.00.0050.00319.05
8.2.180.0120.00916.63
8.2.170.0080.00622.96
8.2.160.0130.00020.32
8.2.150.0070.00024.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00420.83
8.2.110.0080.00022.24
8.2.100.0000.01117.84
8.2.90.0040.00419.12
8.2.80.0030.00517.97
8.2.70.0030.00917.75
8.2.60.0050.00317.91
8.2.50.0040.00418.07
8.2.40.0040.00419.82
8.2.30.0040.00418.20
8.2.20.0040.00417.68
8.2.10.0040.00418.20
8.2.00.0050.00317.86
8.1.280.0110.01125.92
8.1.270.0050.00322.02
8.1.260.0050.00326.35
8.1.250.0050.00328.09
8.1.240.0030.00622.20
8.1.230.0050.00518.97
8.1.220.0040.00417.74
8.1.210.0000.00918.77
8.1.200.0060.00317.48
8.1.190.0080.00017.13
8.1.180.0040.00418.10
8.1.170.0090.00018.64
8.1.160.0000.00722.09
8.1.150.0040.00418.57
8.1.140.0030.00517.48
8.1.130.0030.00317.71
8.1.120.0000.00717.40
8.1.110.0040.00417.47
8.1.100.0030.00517.36
8.1.90.0050.00217.43
8.1.80.0040.00417.46
8.1.70.0030.00317.41
8.1.60.0040.00417.64
8.1.50.0040.00417.42
8.1.40.0000.00817.50
8.1.30.0000.00817.61
8.1.20.0050.00317.56
8.1.10.0000.00717.56
8.1.00.0080.00017.45
8.0.300.0050.00518.77
8.0.290.0030.00517.18
8.0.280.0030.00318.36
8.0.270.0000.00717.13
8.0.260.0000.00817.17
8.0.250.0000.00716.95
8.0.240.0030.00316.84
8.0.230.0040.00416.86
8.0.220.0080.00016.82
8.0.210.0000.00716.90
8.0.200.0040.00416.88
8.0.190.0080.00017.04
8.0.180.0000.00716.91
8.0.170.0040.00416.95
8.0.160.0080.00016.99
8.0.150.0040.00416.94
8.0.140.0030.00616.92
8.0.130.0040.00413.33
8.0.120.0080.00016.95
8.0.110.0000.00716.88
8.0.100.0040.00417.03
8.0.90.0080.00017.00
8.0.80.0090.01216.95
8.0.70.0000.00716.77
8.0.60.0020.00516.87
8.0.50.0000.00716.99
8.0.30.0140.00817.08
8.0.20.0090.00917.40
8.0.10.0040.00416.98
8.0.00.0020.01616.77
7.4.330.0050.00015.01
7.4.320.0030.00316.52
7.4.300.0060.00316.53
7.4.290.0040.00216.53
7.4.280.0000.00816.42
7.4.270.0030.00516.67
7.4.260.0040.00416.40
7.4.250.0040.00416.49
7.4.240.0020.00516.55
7.4.230.0070.00016.43
7.4.220.0030.01316.62
7.4.210.0060.00816.66
7.4.200.0040.00416.71
7.4.190.0070.00016.66
7.4.160.0120.00916.46
7.4.150.0130.00317.40
7.4.140.0150.00817.86
7.4.130.0110.00716.54
7.4.120.0110.01016.52
7.4.110.0070.01016.48
7.4.100.0080.01316.42
7.4.90.0130.00416.47
7.4.80.0110.00719.39
7.4.70.0130.00316.41
7.4.60.0090.00916.50
7.4.50.0000.00816.61
7.4.40.0160.00616.38
7.4.30.0100.00616.58
7.4.00.0070.01014.93
7.3.330.0030.00313.35
7.3.320.0000.00513.43
7.3.310.0040.00416.25
7.3.300.0030.00316.31
7.3.290.0130.00716.45
7.3.280.0100.00816.39
7.3.270.0000.01717.40
7.3.260.0030.01916.30
7.3.250.0100.00716.46
7.3.240.0100.01316.42
7.3.230.0140.00316.48
7.3.210.0090.00916.64
7.3.200.0060.01119.39
7.3.190.0060.01216.39
7.3.180.0090.00916.62
7.3.170.0150.00016.48
7.3.160.0090.00616.66
7.3.120.0060.01114.80
7.3.110.0090.00314.90
7.3.100.0060.00914.90
7.3.90.0060.00314.93
7.3.80.0060.00914.84
7.3.70.0070.00715.00
7.3.60.0060.01014.98
7.3.50.0060.00914.98
7.3.40.0060.00614.84
7.3.30.0040.01114.72
7.3.20.0040.00816.73
7.3.10.0030.00916.79
7.3.00.0060.00916.46
7.2.330.0090.00916.41
7.2.320.0030.01416.39
7.2.310.0070.01416.77
7.2.300.0100.00716.74
7.2.290.0090.01516.71
7.2.250.0060.01614.93
7.2.240.0030.01714.83
7.2.230.0030.01714.81
7.2.220.0040.01015.03
7.2.210.0080.00614.89
7.2.200.0080.00514.98
7.2.190.0030.01314.76
7.2.180.0030.01014.75
7.2.170.0030.00915.08
7.2.80.0030.01116.66
7.2.60.0080.00016.79
7.2.00.0030.01019.04
7.1.330.0100.00315.91
7.1.320.0090.00015.96
7.1.310.0070.00715.68
7.1.300.0070.01015.84
7.1.290.0110.00415.93
7.1.280.0100.00315.60
7.1.270.0040.00715.77
7.1.260.0060.00615.82
7.1.200.0070.00715.72
7.1.100.0110.00618.24
7.1.70.0060.00917.34
7.1.60.0120.01219.46
7.1.50.0070.01317.00
7.1.00.0070.07322.48
7.0.200.0100.01016.56
7.0.140.0100.06322.21
7.0.60.0170.07719.93
7.0.50.0000.05317.89
7.0.40.0070.06720.18
7.0.30.0430.06320.29
7.0.20.0330.06020.15
7.0.10.0030.09020.05
7.0.00.0070.04020.19
5.6.280.0030.07021.16
5.6.210.0100.03720.77
5.6.200.0130.07318.16
5.6.190.0100.04720.57
5.6.180.0070.05720.41
5.6.170.0100.04720.55
5.6.160.0030.09320.57
5.6.150.0130.06318.16
5.6.140.0030.08318.18
5.6.130.0030.04318.18
5.6.120.0170.07321.03
5.6.110.0130.07721.00
5.6.100.0100.08021.04
5.6.90.0070.06721.11
5.6.80.0030.03720.38
5.5.350.0030.08320.36
5.5.340.0070.07317.94
5.5.330.0130.08320.32
5.5.320.0200.04720.35
5.5.310.0200.09720.34
5.5.300.0100.03717.99
5.5.290.0070.04017.92
5.5.280.0130.07720.95
5.5.270.0030.04320.77
5.5.260.0070.08020.77
5.5.250.0030.06720.68
5.5.240.0030.07720.19
5.4.450.0670.05719.70
5.4.440.0600.05719.63
5.4.430.0600.05019.16
5.4.420.0830.04319.57
5.4.410.0870.04019.21
5.4.400.0570.06019.28
5.4.390.0870.05719.29
5.4.380.0330.05318.77
5.4.370.0300.05718.68
5.4.360.0230.05318.73
5.4.350.0270.05718.83
5.4.340.0370.05018.53
5.4.320.0050.03812.50
5.4.310.0090.04012.50
5.4.300.0050.03612.51
5.4.290.0080.03812.50
5.4.280.0100.04012.40
5.4.270.0090.04112.40
5.4.260.0070.03912.40
5.4.250.0080.04312.40
5.4.240.0020.04612.40
5.4.230.0060.03812.39
5.4.220.0060.04412.39
5.4.210.0080.04912.39
5.4.200.0090.05412.39
5.4.190.0050.05012.39
5.4.180.0130.05312.38
5.4.170.0150.04812.40
5.4.160.0100.03812.39
5.4.150.0080.03612.39
5.4.140.0110.03912.07
5.4.130.0080.04112.06
5.4.120.0060.04012.02
5.4.110.0080.04212.02
5.4.100.0110.04612.02
5.4.90.0030.05712.02
5.4.80.0040.04012.01
5.4.70.0070.03612.01
5.4.60.0070.05012.01
5.4.50.0060.04112.01
5.4.40.0070.05012.00
5.4.30.0060.05111.99
5.4.20.0110.04312.00
5.4.10.0070.03412.00
5.4.00.0100.03411.49
5.3.290.0070.04712.80
5.3.280.0040.05412.71
5.3.270.0060.04512.72
5.3.260.0080.03812.72
5.3.250.0050.03812.72
5.3.240.0080.03612.72
5.3.230.0080.04312.71
5.3.220.0140.07212.68
5.3.210.0060.04412.68
5.3.200.0150.04912.68
5.3.190.0080.05212.68
5.3.180.0090.05212.67
5.3.170.0060.05012.67
5.3.160.0080.03512.67
5.3.150.0090.03512.68
5.3.140.0090.04112.66
5.3.130.0040.04612.66
5.3.120.0060.04012.66
5.3.110.0070.04412.66
5.3.100.0060.05212.13
5.3.90.0120.05212.11
5.3.80.0090.05112.10
5.3.70.0120.04012.10
5.3.60.0050.04712.09
5.3.50.0080.04312.03
5.3.40.0080.04012.03
5.3.30.0040.04011.99
5.3.20.0100.03711.77
5.3.10.0080.03711.73
5.3.00.0070.04111.72
5.2.170.0060.0379.22
5.2.160.0090.0359.22
5.2.150.0060.0299.23
5.2.140.0040.0319.22
5.2.130.0050.0299.18
5.2.120.0070.0279.18
5.2.110.0070.0319.19
5.2.100.0070.0369.19
5.2.90.0060.0349.18
5.2.80.0080.0399.18
5.2.70.0060.0459.18
5.2.60.0080.0429.13
5.2.50.0080.0429.11
5.2.40.0070.0359.07
5.2.30.0080.0379.05
5.2.20.0090.0349.05
5.2.10.0070.0288.96
5.2.00.0060.0398.81
5.1.60.0050.0348.09
5.1.50.0040.0278.09
5.1.40.0080.0328.07
5.1.30.0030.0368.43
5.1.20.0050.0398.45
5.1.10.0060.0268.17
5.1.00.0070.0368.17
5.0.50.0050.0286.66
5.0.40.0040.0286.50
5.0.30.0020.0456.32
5.0.20.0050.0266.29
5.0.10.0050.0286.27
5.0.00.0030.0346.27
4.4.90.0060.0144.78
4.4.80.0030.0164.75
4.4.70.0030.0164.76
4.4.60.0050.0144.75
4.4.50.0020.0174.77
4.4.40.0040.0254.71
4.4.30.0010.0174.76
4.4.20.0010.0184.84
4.4.10.0040.0154.85
4.4.00.0030.0264.75
4.3.110.0030.0164.67
4.3.100.0020.0174.66
4.3.90.0040.0144.63
4.3.80.0020.0264.59
4.3.70.0010.0164.63
4.3.60.0020.0154.63
4.3.50.0020.0194.63
4.3.40.0030.0304.54
4.3.30.0010.0173.30
4.3.20.0050.0133.28
4.3.10.0030.0163.24
4.3.00.0030.0206.93

preferences:
68.45 ms | 400 KiB | 5 Q