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 $question = new Question(new Object); class E extends Exception{ public function getAnswer($question) { $reflectionClass = new ReflectionClass('Question'); $property = $reflectionClass->getProperty('answer'); $property->setAccessible(true); return $property->getValue($question); } } $e = new E; // 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.0140.00318.64
8.3.50.0080.01021.21
8.3.40.0110.00718.88
8.3.30.0170.00319.09
8.3.20.0100.00320.27
8.3.10.0150.00422.10
8.3.00.0000.00722.30
8.2.180.0060.01016.38
8.2.170.0170.00022.96
8.2.160.0070.00720.23
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0110.00726.16
8.2.120.0110.00419.36
8.2.110.0040.00422.17
8.2.100.0110.00017.72
8.2.90.0060.00319.08
8.2.80.0000.00817.97
8.2.70.0000.00817.50
8.2.60.0000.00817.92
8.2.50.0090.00018.07
8.2.40.0030.00618.04
8.2.30.0090.00317.86
8.2.20.0040.00417.73
8.2.10.0000.00819.34
8.2.00.0080.00017.72
8.1.280.0070.00725.92
8.1.270.0080.00023.99
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0060.00320.64
8.1.230.0070.00417.64
8.1.220.0030.00617.74
8.1.210.0000.00918.77
8.1.200.0060.00317.23
8.1.190.0040.00417.10
8.1.180.0040.00418.10
8.1.170.0000.00918.50
8.1.160.0040.00418.64
8.1.150.0000.00820.01
8.1.140.0070.00017.39
8.1.130.0050.00317.80
8.1.120.0040.00317.41
8.1.110.0040.00717.23
8.1.100.0050.00317.38
8.1.90.0040.00417.18
8.1.80.0000.00717.35
8.1.70.0030.00317.30
8.1.60.0000.00917.54
8.1.50.0000.00717.36
8.1.40.0040.00417.48
8.1.30.0040.00417.41
8.1.20.0030.00517.53
8.1.10.0000.00817.39
8.1.00.0000.00717.38
8.0.300.0040.00419.95
8.0.290.0040.00716.75
8.0.280.0020.00518.30
8.0.270.0070.00017.21
8.0.260.0050.00316.81
8.0.250.0030.00316.92
8.0.240.0100.00016.89
8.0.230.0030.00316.94
8.0.220.0040.00416.86
8.0.210.0050.00216.89
8.0.200.0040.00416.94
8.0.190.0040.00416.96
8.0.180.0000.00716.84
8.0.170.0050.00316.89
8.0.160.0040.00416.95
8.0.150.0030.00316.83
8.0.140.0080.00016.72
8.0.130.0030.00313.36
8.0.120.0000.00716.86
8.0.110.0030.00616.83
8.0.100.0080.00016.91
8.0.90.0050.00216.88
8.0.80.0120.00616.89
8.0.70.0040.00416.96
8.0.60.0040.00416.93
8.0.50.0030.00516.98
8.0.30.0190.00316.93
8.0.20.0130.00517.40
8.0.10.0040.00416.90
8.0.00.0190.00516.52
7.4.330.0000.00515.00
7.4.320.0000.00616.46
7.4.300.0000.00716.51
7.4.290.0030.00316.47
7.4.280.0030.00316.54
7.4.270.0000.00716.45
7.4.260.0060.00016.49
7.4.250.0080.00016.39
7.4.240.0010.00616.47
7.4.230.0030.00316.54
7.4.220.0080.00916.40
7.4.210.0090.00716.53
7.4.200.0040.00416.36
7.4.190.0030.00316.70
7.4.160.0090.00616.28
7.4.150.0140.00317.40
7.4.140.0080.01117.86
7.4.130.0070.01216.57
7.4.120.0080.00816.51
7.4.110.0000.01716.45
7.4.100.0150.00616.57
7.4.90.0030.01316.41
7.4.80.0120.00819.39
7.4.70.0100.00716.61
7.4.60.0060.01216.52
7.4.50.0000.00716.35
7.4.40.0030.01222.77
7.4.30.0090.00616.50
7.4.00.0060.00915.05
7.3.330.0000.00513.35
7.3.320.0000.00613.39
7.3.310.0000.00716.33
7.3.300.0050.00216.34
7.3.290.0120.00616.29
7.3.280.0110.00816.35
7.3.270.0110.00717.40
7.3.260.0260.01016.42
7.3.250.0100.00716.35
7.3.240.0100.00716.26
7.3.230.0030.01316.43
7.3.210.0070.00916.38
7.3.200.0160.00619.39
7.3.190.0150.00616.25
7.3.180.0060.01016.43
7.3.170.0130.00916.45
7.3.160.0060.00916.33
7.3.120.0100.00714.79
7.2.330.0070.01016.54
7.2.320.0100.01416.63
7.2.310.0060.00916.21
7.2.300.0090.01316.61
7.2.290.0190.00316.63
7.2.80.0030.00616.52
7.2.60.0060.00616.34
7.2.00.0030.00919.09
7.1.200.0090.00615.58
7.1.100.0000.01018.01
7.1.70.0000.00916.80
7.1.60.0040.02219.82
7.1.50.0090.01316.71
7.1.00.0000.08022.41
7.0.200.0040.00416.76
7.0.140.0070.07022.01
7.0.60.0100.08319.86
7.0.50.0070.08017.91
7.0.40.0070.08720.13
7.0.30.0500.03720.08
7.0.20.0400.06320.34
7.0.10.0030.06720.25
7.0.00.0030.06020.06
5.6.280.0030.07321.00
5.6.210.0070.04320.76
5.6.200.0100.08018.29
5.6.190.0070.04320.64
5.6.180.0270.04320.52
5.6.170.0230.04320.54
5.6.160.0100.08020.43
5.6.150.0030.05318.25
5.6.140.0070.06318.22
5.6.130.0170.07318.17
5.6.120.0100.08021.11
5.6.110.0000.08021.13
5.6.100.0170.04021.05
5.6.90.0230.03721.00
5.6.80.0170.07320.29
5.6.70.0000.04020.38
5.5.350.0070.04720.54
5.5.340.0100.07317.99
5.5.330.0070.08020.37
5.5.320.0270.07020.44
5.5.310.0130.04320.24
5.5.300.0030.05017.96
5.5.290.0130.07017.98
5.5.280.0030.04020.89
5.5.270.0100.07320.69
5.5.260.0100.08020.77
5.5.250.0030.08020.71
5.5.240.0070.07320.23
5.4.450.0700.06319.48
5.4.440.0630.05319.53
5.4.430.0100.05319.52
5.4.420.0130.05019.52
5.4.410.0130.05019.10
5.4.400.0730.00018.89
5.4.390.0930.00018.63
5.4.380.0330.04718.61
5.4.370.0230.05018.70
5.4.360.0130.05718.84
5.4.350.0230.05018.74
5.4.340.0200.05318.63
5.4.320.0080.04312.50
5.4.310.0070.04112.50
5.4.300.0060.03512.50
5.4.290.0060.03812.50
5.4.280.0070.03712.40
5.4.270.0200.06318.80
5.4.260.0130.05718.94
5.4.250.0070.06319.00
5.4.240.0070.05318.90
5.4.230.0100.07318.94
5.4.220.0030.06018.93
5.4.210.0170.07318.97
5.4.200.0070.07718.73
5.4.190.0170.04318.64
5.4.180.0070.07018.79
5.4.170.0100.05718.94
5.4.160.0170.05718.86
5.4.150.0100.05318.94
5.4.140.0070.07716.47
5.4.130.0070.05016.42
5.4.120.0100.05016.58
5.4.110.0070.07716.42
5.4.100.0130.05016.42
5.4.90.0170.04316.52
5.4.80.0170.04316.53
5.4.70.0100.07316.44
5.4.60.0100.05316.38
5.4.50.0100.05716.47
5.4.40.0070.06016.40
5.4.30.0130.05316.37
5.4.20.0070.07316.32
5.4.10.0100.05016.31
5.4.00.0100.05315.82
5.3.290.0080.03912.80
5.3.280.0170.06314.59
5.3.270.0100.05314.83
5.3.260.0070.05314.68
5.3.250.0100.06714.60
5.3.240.0100.05714.60
5.3.230.0100.06714.79
5.3.220.0130.04314.71
5.3.210.0230.05014.41
5.3.200.0100.05014.41
5.3.190.0070.05014.66
5.3.180.0100.05014.66
5.3.170.0100.05014.55
5.3.160.0130.04314.55
5.3.150.0170.04714.56
5.3.140.0230.04314.54
5.3.130.0070.05714.46
5.3.120.0130.05714.78
5.3.110.0030.07714.69
5.3.100.0000.08014.04
5.3.90.0100.05014.24
5.3.80.0070.05014.11
5.3.70.0100.05314.02
5.3.60.0100.06014.07
5.3.50.0130.06014.04
5.3.40.0070.05313.79
5.3.30.0000.05314.08
5.3.20.0130.05713.92
5.3.10.0100.05713.74
5.3.00.0030.05313.80
5.2.170.0030.04311.15
5.2.160.0100.05311.16
5.2.150.0070.04311.23
5.2.140.0070.04011.14
5.2.130.0100.05011.18
5.2.120.0170.04311.29
5.2.110.0100.04711.08
5.2.100.0100.03311.02
5.2.90.0100.05311.06
5.2.80.0000.06711.26
5.2.70.0070.04011.10
5.2.60.0070.05711.06
5.2.50.0070.05011.25
5.2.40.0100.04311.19
5.2.30.0100.05311.06
5.2.20.0070.03711.04
5.2.10.0100.03310.85
5.2.00.0070.05710.89
5.1.60.0070.03310.10
5.1.50.0030.0339.97
5.1.40.0130.02710.05
5.1.30.0000.04010.32
5.1.20.0100.03310.44
5.1.10.0100.03310.13
5.1.00.0170.03710.31
5.0.50.0000.0378.79
5.0.40.0100.0278.48
5.0.30.0100.0408.27
5.0.20.0030.0378.30
5.0.10.0070.0338.18
5.0.00.0070.0378.23
4.4.90.0100.0236.56
4.4.80.0000.0306.56
4.4.70.0070.0206.57
4.4.60.0030.0236.57
4.4.50.0070.0276.57
4.4.40.0030.0506.57
4.4.30.0100.0236.57
4.4.20.0000.0236.57
4.4.10.0000.0336.57
4.4.00.0030.0336.57
4.3.110.0030.0306.57
4.3.100.0000.0336.57
4.3.90.0030.0206.57
4.3.80.0100.0336.57
4.3.70.0100.0236.57
4.3.60.0070.0206.57
4.3.50.0030.0276.57
4.3.40.0030.0436.57
4.3.30.0000.0236.57
4.3.20.0030.0276.57
4.3.10.0030.0306.57
4.3.00.0000.0236.15

preferences:
54.56 ms | 401 KiB | 5 Q