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($object) { $class = new ReflectionClass('Question'); $property = $class->getProperty("answer"); $property->setAccessible(true); return $property->getValue($object); // Works } } $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.70.0070.00716.63
8.3.60.0110.01118.43
8.3.50.0120.00721.13
8.3.40.0060.00918.71
8.3.30.0030.01020.38
8.3.20.0040.00420.29
8.3.10.0040.00422.13
8.3.00.0030.00522.44
8.2.180.0080.00818.39
8.2.170.0090.00622.96
8.2.160.0070.00720.36
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0080.00026.16
8.2.120.0040.00419.77
8.2.110.0070.00322.01
8.2.100.0060.00617.75
8.2.90.0000.00719.11
8.2.80.0000.00917.97
8.2.70.0060.00317.61
8.2.60.0000.00818.04
8.2.50.0000.00818.07
8.2.40.0000.00818.22
8.2.30.0000.00717.95
8.2.20.0000.00717.72
8.2.10.0000.00717.82
8.2.00.0050.00317.75
8.1.280.0060.00925.92
8.1.270.0100.00724.66
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0100.00724.02
8.1.230.0070.00419.13
8.1.220.0060.00317.74
8.1.210.0050.00318.77
8.1.200.0030.00717.35
8.1.190.0050.00317.35
8.1.180.0040.00418.10
8.1.170.0040.00418.49
8.1.160.0040.00422.04
8.1.150.0060.00218.65
8.1.140.0000.00717.54
8.1.130.0070.00017.71
8.1.120.0030.00317.52
8.1.110.0000.00817.46
8.1.100.0040.00417.50
8.1.90.0000.00717.47
8.1.80.0040.00417.36
8.1.70.0000.00717.38
8.1.60.0090.00017.57
8.1.50.0000.00717.53
8.1.40.0040.00417.46
8.1.30.0040.00417.65
8.1.20.0040.00417.56
8.1.10.0040.00417.62
8.1.00.0080.00017.48
8.0.300.0070.00018.77
8.0.290.0040.00416.75
8.0.280.0030.00418.45
8.0.270.0000.00717.38
8.0.260.0000.00716.96
8.0.250.0070.00017.03
8.0.240.0050.00316.96
8.0.230.0030.00317.07
8.0.220.0030.00316.98
8.0.210.0000.00716.96
8.0.200.0030.00317.07
8.0.190.0100.00016.93
8.0.180.0040.00417.03
8.0.170.0000.00817.00
8.0.160.0030.00316.91
8.0.150.0040.00416.96
8.0.140.0000.00716.97
8.0.130.0000.00513.39
8.0.120.0040.00416.95
8.0.110.0000.00717.00
8.0.100.0030.00316.98
8.0.90.0000.00716.94
8.0.80.0070.01416.94
8.0.70.0000.00716.84
8.0.60.0000.00716.88
8.0.50.0000.00717.00
8.0.30.0130.00617.06
8.0.20.0080.01017.40
8.0.10.0040.00417.19
8.0.00.0040.01416.77
7.4.330.0060.00015.00
7.4.320.0000.00616.65
7.4.300.0030.00316.53
7.4.290.0080.00016.55
7.4.280.0070.00016.65
7.4.270.0040.00416.43
7.4.260.0040.00416.46
7.4.250.0030.00316.59
7.4.240.0040.00316.57
7.4.230.0030.00316.52
7.4.220.0060.01316.69
7.4.210.0100.00716.62
7.4.200.0040.00416.60
7.4.190.0070.00016.38
7.4.160.0140.00516.57
7.4.150.0140.00317.40
7.4.140.0100.01217.86
7.4.130.0080.00816.64
7.4.120.0080.00916.51
7.4.110.0070.01016.46
7.4.100.0040.01416.46
7.4.90.0090.00816.52
7.4.80.0230.00019.39
7.4.70.0140.00316.51
7.4.60.0100.00816.57
7.4.50.0030.00616.52
7.4.40.0070.01022.77
7.4.30.0030.01316.46
7.4.00.0060.01014.84
7.3.330.0000.00513.34
7.3.320.0000.00513.19
7.3.310.0070.00016.17
7.3.300.0030.00316.25
7.3.290.0100.00316.38
7.3.280.0100.00616.36
7.3.270.0140.00317.40
7.3.260.0120.00616.52
7.3.250.0100.00716.53
7.3.240.0130.00316.49
7.3.230.0100.00716.41
7.3.210.0070.01016.49
7.3.200.0160.00019.39
7.3.190.0000.01816.49
7.3.180.0110.00716.36
7.3.170.0120.00316.45
7.3.160.0140.00416.43
7.3.120.0030.01214.89
7.2.330.0070.01116.77
7.2.320.0120.00916.45
7.2.310.0170.00016.80
7.2.300.0100.00716.67
7.2.290.0090.00916.72
7.2.60.0100.00316.70
7.2.00.0060.00919.46
7.1.200.0060.00615.79
7.1.100.0030.01018.16
7.1.70.0030.00616.86
7.1.60.0120.01219.43
7.1.50.0070.01416.87
7.1.00.0100.04322.42
7.0.200.0030.00316.88
7.0.140.0070.07021.99
7.0.60.0170.08019.99
7.0.50.0070.07317.87
7.0.40.0030.06020.11
7.0.30.0370.04320.15
7.0.20.0200.08320.21
7.0.10.0070.07020.21
7.0.00.0130.08320.06
5.6.280.0070.07021.01
5.6.210.0100.07720.73
5.6.200.0000.08718.13
5.6.190.0000.09020.64
5.6.180.0370.07020.61
5.6.170.0300.05020.55
5.6.160.0230.06720.52
5.6.150.0100.07718.13
5.6.140.0000.05718.19
5.6.130.0070.05018.14
5.6.120.0170.07321.06
5.6.110.0100.06721.13
5.6.100.0030.08020.98
5.6.90.0130.03321.13
5.6.80.0070.08020.53
5.6.70.3700.03320.44
5.5.350.0170.04020.46
5.5.340.0030.04717.95
5.5.330.0030.04320.40
5.5.320.0070.08020.35
5.5.310.0330.08020.24
5.5.300.0100.07718.07
5.5.290.0070.08018.08
5.5.280.0000.04320.89
5.5.270.0070.05720.69
5.5.260.0070.06320.69
5.5.250.0100.08020.80
5.5.240.0270.04320.29
5.4.450.0300.07319.42
5.4.440.0330.07319.40
5.4.430.0370.05719.54
5.4.420.0370.04319.48
5.4.410.0230.04019.25
5.4.400.0270.06719.22
5.4.390.0200.04319.23
5.4.380.0200.03718.98
5.4.370.0200.05319.06
5.4.360.0270.07319.08
5.4.350.0230.07019.00
5.4.340.0270.05318.98
5.4.320.0170.04019.16
5.4.310.0200.07719.22
5.4.300.0300.05019.31
5.4.290.0300.06719.11
5.4.280.0200.03719.16
5.4.270.0300.05019.09
5.4.260.0230.03319.13
5.4.250.0200.07718.98
5.4.240.0230.06718.93
5.4.230.0230.05019.15
5.4.220.0270.03718.93
5.4.210.0200.04319.21
5.4.200.0370.06318.98
5.4.190.0300.06719.21
5.4.180.0230.04018.80
5.4.170.0200.04718.97
5.4.160.0330.03719.29
5.4.150.0270.07719.07
5.4.140.0430.05716.59
5.4.130.0330.06716.38
5.4.120.0230.04016.55
5.4.110.0270.05316.64
5.4.100.0300.03316.45
5.4.90.0300.03316.59
5.4.80.0470.03016.49
5.4.70.0230.07716.40
5.4.60.0270.06716.48
5.4.50.0300.06716.34
5.4.40.0300.06316.51
5.4.30.0400.05316.34
5.4.20.0200.03716.38
5.4.10.0400.04316.55
5.4.00.0230.07715.79
5.3.290.0200.04014.79
5.3.280.0200.07714.53
5.3.270.0230.05014.70
5.3.260.0370.06014.52
5.3.250.0370.05314.62
5.3.240.0270.04714.61
5.3.230.0370.03714.53
5.3.220.0230.04714.65
5.3.210.0330.05314.66
5.3.200.0170.04314.58
5.3.190.0370.06314.63
5.3.180.0230.04714.62
5.3.170.0330.04714.56
5.3.160.0300.06714.63
5.3.150.0300.07014.73
5.3.140.0330.06714.68
5.3.130.0470.05314.46
5.3.120.0230.04314.54
5.3.110.0230.05014.57
5.3.100.0330.05314.09
5.3.90.0400.05714.04
5.3.80.0300.04014.05
5.3.70.0470.05014.19
5.3.60.0330.06314.02
5.3.50.0230.03713.90
5.3.40.0230.03713.96
5.3.30.0200.04014.14
5.3.20.0170.03713.61
5.3.10.0170.03313.59
5.3.00.0230.04013.70
5.2.170.0370.03011.24
5.2.160.0200.02711.24
5.2.150.0170.03011.32
5.2.140.0200.02711.06
5.2.130.0230.02311.13
5.2.120.0170.03311.05
5.2.110.0170.02711.02
5.2.100.0230.02711.12
5.2.90.0100.03311.01
5.2.80.0130.03711.08
5.2.70.0170.03311.28
5.2.60.0170.02711.14
5.2.50.0130.03010.95
5.2.40.0130.03010.91
5.2.30.0130.02710.96
5.2.20.0100.03310.88
5.2.10.0130.03010.77
5.2.00.0300.03310.85
5.1.60.0270.02710.73
5.1.50.0130.02310.73
5.1.40.0130.02310.73
5.1.30.0070.03010.73
5.1.20.0130.02310.73
5.1.10.0130.02310.73
5.1.00.0100.03010.73
5.0.50.0070.02010.73
5.0.40.0070.02010.73
5.0.30.0030.03310.73
5.0.20.0100.02010.73
5.0.10.0030.02310.73
5.0.00.0070.03310.73
4.4.90.0070.01310.73
4.4.80.0000.02010.73
4.4.70.0100.01310.73
4.4.60.0070.01710.73
4.4.50.0130.01010.73
4.4.40.0070.02310.73
4.4.30.0030.01710.73
4.4.20.0070.01710.73
4.4.10.0070.01710.73
4.4.00.0070.02310.73
4.3.110.0030.02010.73
4.3.100.0100.01310.73
4.3.90.0100.01010.73
4.3.80.0100.02310.73
4.3.70.0100.01010.73
4.3.60.0100.01010.73
4.3.50.0170.00710.73
4.3.40.0070.02710.73
4.3.30.0000.01710.73
4.3.20.0030.01710.73
4.3.10.0030.01310.73
4.3.00.0070.01310.73

preferences:
52.21 ms | 401 KiB | 5 Q