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); return $qReflect->getProperty('answer')->getValue(); } } $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.0150.00316.63
8.3.50.0130.01022.02
8.3.40.0090.00618.74
8.3.30.0110.00419.08
8.3.20.0040.01120.16
8.3.10.0040.00423.56
8.3.00.0000.00819.14
8.2.180.0120.00616.63
8.2.170.0070.00722.96
8.2.160.0140.00020.35
8.2.150.0070.00724.18
8.2.140.0100.00524.66
8.2.130.0000.00726.16
8.2.120.0040.00420.83
8.2.110.0000.01022.11
8.2.100.0090.00317.59
8.2.90.0040.00419.09
8.2.80.0040.00417.97
8.2.70.0060.00617.50
8.2.60.0040.00417.79
8.2.50.0040.00418.07
8.2.40.0040.00419.70
8.2.30.0040.00418.07
8.2.20.0070.00017.70
8.2.10.0040.00418.12
8.2.00.0040.00417.63
8.1.280.0100.00725.92
8.1.270.0040.00422.02
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0050.00323.92
8.1.230.0030.00819.20
8.1.220.0080.00017.76
8.1.210.0040.00418.77
8.1.200.0030.00817.36
8.1.190.0000.00817.21
8.1.180.0080.00018.96
8.1.170.0050.00618.64
8.1.160.0000.00721.95
8.1.150.0000.00818.63
8.1.140.0040.00417.43
8.1.130.0040.00217.88
8.1.120.0070.00017.53
8.1.110.0050.00317.56
8.1.100.0030.00617.46
8.1.90.0050.00217.48
8.1.80.0040.00417.49
8.1.70.0030.00317.44
8.1.60.0070.00317.61
8.1.50.0050.00217.59
8.1.40.0040.00417.50
8.1.30.0040.00417.53
8.1.20.0000.00817.63
8.1.10.0040.00417.57
8.1.00.0050.00217.52
8.0.300.0000.00718.77
8.0.290.0040.00417.05
8.0.280.0080.00018.46
8.0.270.0070.00017.13
8.0.260.0060.00317.17
8.0.250.0050.00216.99
8.0.240.0030.00316.84
8.0.230.0000.00816.97
8.0.220.0000.00816.82
8.0.210.0080.00016.87
8.0.200.0000.00816.86
8.0.190.0000.00716.98
8.0.180.0060.00316.93
8.0.170.0000.00716.84
8.0.160.0030.00616.95
8.0.150.0040.00416.75
8.0.140.0050.00516.97
8.0.130.0030.00313.41
8.0.120.0000.00816.96
8.0.110.0000.00716.93
8.0.100.0040.00416.78
8.0.90.0070.00016.83
8.0.80.0150.00617.00
8.0.70.0080.00016.86
8.0.60.0000.00716.99
8.0.50.0040.00416.97
8.0.30.0140.00517.12
8.0.20.0120.01117.46
8.0.10.0040.00416.98
8.0.00.0080.00916.88
7.4.330.0020.00215.00
7.4.320.0030.00316.63
7.4.300.0080.00016.68
7.4.290.0030.00316.63
7.4.280.0040.00416.54
7.4.270.0040.00416.54
7.4.260.0070.00016.39
7.4.250.0040.00416.45
7.4.240.0020.00516.53
7.4.230.0070.00016.61
7.4.220.0090.01316.70
7.4.210.0060.00816.64
7.4.200.0070.00016.51
7.4.190.0040.00416.44
7.4.160.0060.01016.73
7.4.150.0120.00617.40
7.4.140.0080.01117.86
7.4.130.0100.00916.63
7.4.120.0100.00716.55
7.4.110.0040.01216.60
7.4.100.0070.01016.64
7.4.90.0100.00716.47
7.4.80.0060.01319.39
7.4.70.0060.01216.56
7.4.60.0100.00716.52
7.4.50.0040.00416.49
7.4.40.0110.00816.65
7.4.30.0130.00316.78
7.4.00.0090.00814.88
7.3.330.0030.00313.37
7.3.320.0000.00513.17
7.3.310.0000.00616.23
7.3.300.0000.00816.39
7.3.290.0130.00316.34
7.3.280.0050.01316.32
7.3.270.0060.00917.40
7.3.260.0120.01216.38
7.3.250.0110.00616.40
7.3.240.0110.00516.59
7.3.230.0150.00316.39
7.3.210.0090.00816.28
7.3.200.0170.00019.39
7.3.190.0100.01016.28
7.3.180.0080.00816.35
7.3.170.0100.00716.58
7.3.160.0070.01016.30
7.3.120.0040.01314.84
7.3.110.0100.00714.57
7.3.100.0000.01414.70
7.3.90.0030.01014.90
7.3.80.0060.01014.95
7.3.70.0030.01014.86
7.3.60.0110.00314.50
7.3.50.0030.00714.91
7.3.40.0080.00414.87
7.3.30.0070.00714.83
7.3.20.0110.00016.55
7.3.10.0110.00316.58
7.3.00.0130.00316.79
7.2.330.0120.01216.82
7.2.320.0090.00916.82
7.2.310.0060.00916.56
7.2.300.0130.00316.76
7.2.290.0150.00816.62
7.2.250.0070.01414.94
7.2.240.0090.00914.55
7.2.230.0060.00314.57
7.2.220.0000.01415.02
7.2.210.0070.00715.06
7.2.200.0130.00314.71
7.2.190.0030.00815.07
7.2.180.0110.00414.60
7.2.170.0060.00914.85
7.2.60.0040.01116.88
7.2.00.0000.01019.57
7.1.330.0000.01315.79
7.1.320.0040.00815.66
7.1.310.0030.01015.61
7.1.300.0030.00915.59
7.1.290.0030.00715.75
7.1.280.0100.00315.67
7.1.270.0100.00315.67
7.1.260.0070.00715.36
7.1.200.0060.00915.73
7.1.100.0080.00818.24
7.1.70.0040.00417.13
7.1.60.0110.01519.46
7.1.50.0130.01716.93
7.1.00.0070.07322.51
7.0.200.0100.00716.77
7.0.140.0030.06722.21
7.0.60.0000.04319.88
7.0.50.0130.08017.83
7.0.40.0130.07320.25
7.0.30.0170.05320.26
7.0.20.0430.07020.06
7.0.10.0070.08720.21
7.0.00.0030.05020.24
5.6.280.0070.07321.10
5.6.210.0070.03720.67
5.6.200.0030.04318.16
5.6.190.0030.08320.46
5.6.180.0100.07720.57
5.6.170.0200.08320.44
5.6.160.0030.09020.47
5.6.150.0030.04318.15
5.6.140.0070.06318.19
5.6.130.0000.08718.18
5.6.120.0100.06721.05
5.6.110.0130.07721.02
5.6.100.0030.06721.09
5.6.90.0070.06720.86
5.6.80.0100.03320.36
5.5.350.0030.08320.48
5.5.340.0170.07317.99
5.5.330.0100.04320.29
5.5.320.0230.08020.33
5.5.310.0300.08020.19
5.5.300.0100.06317.99
5.5.290.0130.07317.94
5.5.280.0070.09020.78
5.5.270.0070.04020.77
5.5.260.0130.07720.90
5.5.250.0100.07020.55
5.5.240.0000.05320.24
5.4.450.0900.05719.17
5.4.440.0870.04719.61
5.4.430.0670.07019.69
5.4.420.0630.05719.54
5.4.410.0530.06319.48
5.4.400.0730.06019.29
5.4.390.0830.05719.25
5.4.380.0430.05718.58
5.4.370.0270.05718.71
5.4.360.0370.04318.74
5.4.350.0370.05018.75
5.4.340.0370.04718.84
5.4.320.0060.03712.52
5.4.310.0060.03612.51
5.4.300.0090.03712.52
5.4.290.0140.06712.51
5.4.280.0090.04612.41
5.4.270.0080.05112.41
5.4.260.0140.04812.41
5.4.250.0050.05612.40
5.4.240.0080.05212.41
5.4.230.0060.05412.39
5.4.220.0070.05512.40
5.4.210.0120.04012.40
5.4.200.0220.09412.40
5.4.190.0070.05512.39
5.4.180.0150.06612.39
5.4.170.0100.05312.40
5.4.160.0130.06612.40
5.4.150.0150.07512.39
5.4.140.0070.04912.08
5.4.130.0130.06712.07
5.4.120.0080.04412.02
5.4.110.0100.04212.03
5.4.100.0110.07112.02
5.4.90.0200.06912.02
5.4.80.0170.07412.02
5.4.70.0100.07212.02
5.4.60.0150.04912.02
5.4.50.0090.05412.02
5.4.40.0140.08512.01
5.4.30.0120.07112.00
5.4.20.0100.05212.00
5.4.10.0110.06512.01
5.4.00.0080.05611.50
5.3.290.0050.04012.80
5.3.280.0090.04912.71
5.3.270.0120.05012.72
5.3.260.0140.06412.72
5.3.250.0150.05012.72
5.3.240.0160.07712.72
5.3.230.0140.05612.71
5.3.220.0130.04712.68
5.3.210.0110.03712.68
5.3.200.0090.03612.68
5.3.190.0100.04912.68
5.3.180.0100.04812.67
5.3.170.0110.05012.67
5.3.160.0110.04812.67
5.3.150.0060.05512.68
5.3.140.0160.04912.66
5.3.130.0080.05612.66
5.3.120.0090.06212.66
5.3.110.0110.07512.66
5.3.100.0130.06212.14
5.3.90.0040.04612.11
5.3.80.0050.04312.11
5.3.70.0030.04412.11
5.3.60.0130.05712.09
5.3.50.0070.04412.04
5.3.40.0140.04312.04
5.3.30.0110.06512.00
5.3.20.0180.09411.78
5.3.10.0050.04111.74
5.3.00.0070.04211.73
5.2.170.0120.0279.23
5.2.160.0030.0369.24
5.2.150.0090.0359.24
5.2.140.0070.0349.23
5.2.130.0060.0299.20
5.2.120.0070.0289.19
5.2.110.0060.0319.20
5.2.100.0080.0289.19
5.2.90.0060.0319.20
5.2.80.0080.0299.19
5.2.70.0060.0369.19
5.2.60.0090.0419.14
5.2.50.0070.0429.11
5.2.40.0060.0439.09
5.2.30.0110.0409.07
5.2.20.0060.0409.05
5.2.10.0040.0378.96
5.2.00.0030.0338.83
5.1.60.0070.0248.10
5.1.50.0070.0268.09
5.1.40.0060.0288.07
5.1.30.0040.0288.43
5.1.20.0040.0288.45
5.1.10.0040.0298.19
5.1.00.0070.0358.19
5.0.50.0070.0246.67
5.0.40.0050.0266.52
5.0.30.0050.0346.34
5.0.20.0030.0226.30
5.0.10.0020.0246.28
5.0.00.0050.0326.27
4.4.90.0040.0184.78
4.4.80.0020.0334.75
4.4.70.0050.0184.76
4.4.60.0040.0224.76
4.4.50.0060.0164.77
4.4.40.0020.0294.71
4.4.30.0040.0164.76
4.4.20.0040.0184.84
4.4.10.0040.0144.85
4.4.00.0050.0294.76
4.3.110.0120.0284.66
4.3.100.0050.0214.66
4.3.90.0020.0214.63
4.3.80.0030.0334.58
4.3.70.0040.0184.63
4.3.60.0040.0274.63
4.3.50.0060.0184.63
4.3.40.0120.0464.54
4.3.30.0030.0173.30
4.3.20.0040.0183.28
4.3.10.0020.0233.24
4.3.00.0170.0206.94

preferences:
40.74 ms | 401 KiB | 5 Q