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(get_class($object)); $property = $class->getProperty("answer"); $property->setAccessible(true); return $property->getValue($object); } } $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.0110.00418.55
8.3.50.0150.00317.28
8.3.40.0110.00318.81
8.3.30.0090.00618.82
8.3.20.0050.00318.76
8.3.10.0060.00320.60
8.3.00.0030.00617.50
8.2.180.0110.00816.63
8.2.170.0140.00322.96
8.2.160.0070.00722.27
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0050.00326.16
8.2.120.0030.00519.82
8.2.110.0090.00021.13
8.2.100.0060.00617.91
8.2.90.0000.00819.23
8.2.80.0030.00518.16
8.2.70.0040.00417.75
8.2.60.0030.00517.93
8.2.50.0000.00818.07
8.2.40.0070.00019.88
8.2.30.0000.00818.14
8.2.20.0040.00417.73
8.2.10.0040.00417.72
8.2.00.0040.00417.76
8.1.280.0070.01325.92
8.1.270.0080.00024.66
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0050.00520.70
8.1.230.0120.00020.86
8.1.220.0040.00417.77
8.1.210.0000.00818.97
8.1.200.0030.00617.47
8.1.190.0000.00817.39
8.1.180.0030.00618.10
8.1.170.0000.00818.90
8.1.160.0050.00318.82
8.1.150.0070.00018.64
8.1.140.0060.00317.45
8.1.130.0070.00017.90
8.1.120.0040.00417.36
8.1.110.0040.00417.37
8.1.100.0040.00417.44
8.1.90.0000.00817.45
8.1.80.0000.00717.44
8.1.70.0030.00317.44
8.1.60.0000.00817.48
8.1.50.0050.00317.57
8.1.40.0030.00617.55
8.1.30.0050.00217.56
8.1.20.0060.00317.58
8.1.10.0040.00417.49
8.1.00.0040.00417.54
8.0.300.0040.00419.98
8.0.290.0070.00016.75
8.0.280.0000.00818.35
8.0.270.0000.00717.39
8.0.260.0000.00716.91
8.0.250.0030.00417.01
8.0.240.0080.00016.94
8.0.230.0050.00217.09
8.0.220.0040.00416.87
8.0.210.0000.00717.00
8.0.200.0030.00316.90
8.0.190.0000.00817.09
8.0.180.0040.00416.97
8.0.170.0030.00516.88
8.0.160.0040.00417.07
8.0.150.0050.00316.95
8.0.140.0060.00316.92
8.0.130.0050.00013.36
8.0.120.0080.00016.84
8.0.110.0060.00316.80
8.0.100.0040.00416.83
8.0.90.0000.00816.77
8.0.80.0090.00617.02
8.0.70.0040.00416.95
8.0.60.0040.00416.77
8.0.50.0040.00417.07
8.0.30.0120.00617.09
8.0.20.0090.01217.15
8.0.10.0040.00417.09
8.0.00.0100.01216.75
7.4.330.0000.00514.77
7.4.320.0000.00716.57
7.4.300.0000.00816.50
7.4.290.0040.00416.51
7.4.280.0000.01016.55
7.4.270.0070.00016.64
7.4.260.0030.00313.19
7.4.250.0000.00716.60
7.4.240.0070.00016.57
7.4.230.0030.00316.39
7.4.220.0070.01016.59
7.4.210.0100.00616.52
7.4.200.0040.00416.71
7.4.190.0040.00416.71
7.4.160.0080.00816.44
7.4.150.0030.01417.07
7.4.140.0080.00917.24
7.4.130.0030.01716.45
7.4.120.0080.00916.69
7.4.110.0120.01216.61
7.4.100.0190.00616.52
7.4.90.0080.00816.49
7.4.80.0150.00418.80
7.4.70.0070.01316.45
7.4.60.0030.01416.61
7.4.50.0000.00823.17
7.4.40.0070.00721.69
7.4.30.0130.00716.38
7.4.10.0060.01215.05
7.4.00.0090.00814.99
7.3.330.0000.00713.29
7.3.320.0040.00413.26
7.3.310.0040.00416.41
7.3.300.0030.00316.40
7.3.290.0060.00916.43
7.3.280.0150.00316.42
7.3.270.0060.01317.07
7.3.260.0110.00618.24
7.3.250.0120.00916.64
7.3.240.0100.00616.55
7.3.230.0070.01016.39
7.3.210.0100.00616.45
7.3.200.0090.00819.39
7.3.190.0030.01516.61
7.3.180.0080.00816.42
7.3.170.0070.01016.64
7.3.160.0120.00316.35
7.3.130.0070.01314.88
7.3.120.0050.01214.97
7.3.110.0100.01014.98
7.3.100.0060.00914.77
7.3.90.0070.00714.79
7.3.80.0030.00615.14
7.3.70.0030.01414.90
7.3.60.0000.01414.84
7.3.50.0060.00614.89
7.3.40.0030.00714.82
7.3.30.0110.00315.00
7.3.20.0060.00616.77
7.3.10.0030.00816.62
7.3.00.0000.01116.71
7.2.330.0140.00316.39
7.2.320.0030.01316.73
7.2.310.0060.01316.43
7.2.300.0070.01116.73
7.2.290.0060.01016.75
7.2.260.0000.01615.23
7.2.250.0040.01514.98
7.2.240.0000.01415.27
7.2.230.0120.00415.08
7.2.220.0030.01615.31
7.2.210.0030.01015.25
7.2.200.0030.01015.16
7.2.190.0060.01215.06
7.2.180.0070.01015.19
7.2.170.0070.00715.12
7.2.160.0040.00914.89
7.2.150.0080.00817.07
7.2.140.0050.01216.92
7.2.130.0070.00716.98
7.2.120.0080.00717.00
7.2.110.0050.00816.83
7.2.100.0060.01016.75
7.2.90.0070.00617.00
7.2.80.0040.00817.01
7.2.70.0070.00916.97
7.2.60.0040.00916.91
7.2.50.0050.00817.02
7.2.40.0080.00716.94
7.2.30.0080.00616.76
7.2.20.0030.01116.94
7.2.10.0070.00716.95
7.2.00.0110.00416.84
7.1.330.0090.00315.86
7.1.320.0140.00715.70
7.1.310.0040.00815.89
7.1.300.0070.01015.69
7.1.290.0030.00615.62
7.1.280.0110.00415.72
7.1.270.0040.01015.75
7.1.260.0060.00315.61
7.1.250.0030.01115.88
7.1.240.0000.01515.97
7.1.230.0090.00615.62
7.1.220.0040.01115.90
7.1.210.0030.00915.90
7.1.200.0070.00715.71
7.1.190.0120.00415.47
7.1.180.0100.00715.87
7.1.170.0030.01015.87
7.1.160.0120.00615.40
7.1.150.0030.01315.48
7.1.140.0000.01015.75
7.1.130.0070.00715.55
7.1.120.0000.00915.93
7.1.110.0100.00015.80
7.1.100.0090.00315.84
7.1.90.0000.01215.87
7.1.80.0000.01015.89
7.1.70.0050.00516.48
7.1.60.0050.00517.47
7.1.50.0090.00516.51
7.1.40.0060.00615.79
7.1.30.0060.00615.79
7.1.20.0030.01515.94
7.1.10.0000.01315.78
7.1.00.0050.04319.00
7.0.330.0030.01015.50
7.0.320.0060.00615.27
7.0.310.0100.00715.42
7.0.300.0090.00315.24
7.0.290.0040.01115.41
7.0.280.0030.00615.36
7.0.270.0040.01115.48
7.0.260.0070.00715.20
7.0.250.0000.00915.44
7.0.240.0090.00615.34
7.0.230.0000.01315.11
7.0.220.0070.00315.46
7.0.210.0000.01515.63
7.0.200.0060.00216.16
7.0.190.0070.00715.48
7.0.180.0070.00315.63
7.0.170.0000.01215.46
7.0.160.0060.00615.36
7.0.150.0060.00915.50
7.0.140.0060.03718.77
7.0.130.0040.00815.31
7.0.120.0060.01818.77
7.0.110.0030.01415.42
7.0.100.0060.00615.61
7.0.90.0090.00615.41
7.0.80.0000.01515.34
7.0.70.0120.00315.33
7.0.60.0050.04017.81
7.0.50.0060.04016.77
7.0.40.0050.02515.66
7.0.30.0050.02315.54
7.0.20.0080.02415.66
7.0.10.0050.03115.64
7.0.00.0030.03715.46
5.6.400.0030.00614.33
5.6.390.0100.00714.29
5.6.380.0070.00714.45
5.6.370.0070.00714.51
5.6.360.0070.00714.28
5.6.350.0070.01014.11
5.6.340.0030.00914.52
5.6.330.0000.01714.44
5.6.320.0030.01014.27
5.6.310.0100.00714.14
5.6.300.0030.01314.05
5.6.290.0100.00714.28
5.6.280.0050.03917.67
5.6.270.0100.00314.43
5.6.260.0070.01014.37
5.6.250.0060.00614.38
5.6.240.0030.00614.41
5.6.230.0090.00314.13
5.6.220.0090.00614.21
5.6.210.0030.03317.42
5.6.200.0040.03216.16
5.6.190.0090.02816.24
5.6.180.0110.03616.20
5.6.170.0060.02316.16
5.6.160.0060.04616.34
5.6.150.0080.03816.29
5.6.140.0060.02616.23
5.6.130.0040.03816.34
5.6.120.0030.03016.26
5.6.110.0070.02516.33
5.6.100.0090.03116.15
5.6.90.0100.04316.25
5.6.80.0070.04216.00
5.6.70.0070.04215.95
5.6.60.0100.04015.86
5.6.50.0070.03415.74
5.6.40.0070.02515.84
5.6.30.0070.04015.87
5.6.20.0060.03415.89
5.6.10.0050.02316.06
5.6.00.0070.02515.85
5.5.380.0040.01214.16
5.5.370.0070.01014.21
5.5.360.0120.00314.34
5.5.350.0190.04417.31
5.5.340.0000.03316.17
5.5.330.0030.04416.06
5.5.320.0110.01815.96
5.5.310.0050.04016.25
5.5.300.0050.04716.01
5.5.290.0070.04816.17
5.5.280.0050.04116.02
5.5.270.0050.04616.19
5.5.260.0000.03916.26
5.5.250.0100.03616.03
5.5.240.0070.03215.65
5.5.230.0120.03815.79
5.5.220.0080.04215.88
5.5.210.0050.03915.91
5.5.200.0050.02515.57
5.5.190.0020.04415.69
5.5.180.0080.03815.72
5.5.170.0070.00714.25
5.5.160.0060.04315.86
5.5.150.0050.02915.87
5.5.140.0030.02615.70
5.5.130.0080.03615.67
5.5.120.0070.04115.75
5.5.110.0060.03515.68
5.5.100.0100.01815.68
5.5.90.0060.02815.68
5.5.80.0070.03915.64
5.5.70.0070.02515.64
5.5.60.0070.04015.70
5.5.50.0150.03515.71
5.5.40.0110.03315.60
5.5.30.0040.02315.72
5.5.20.0030.02815.68
5.5.10.0070.02915.84
5.5.00.0040.04615.51
5.4.450.0020.04816.29
5.4.440.0000.03416.30
5.4.430.0070.04016.30
5.4.420.0080.03716.28
5.4.410.0020.04416.23
5.4.400.0070.03216.14
5.4.390.0040.02716.14
5.4.380.0030.03416.16
5.4.370.0050.04316.12
5.4.360.0000.03616.10
5.4.350.0080.01916.06
5.4.340.0100.03816.13
5.4.330.0070.00413.22
5.4.320.0050.04316.06
5.4.310.0020.02616.18
5.4.300.0080.04016.17
5.4.290.0050.03816.11
5.4.280.0070.04216.13
5.4.270.0060.04116.14
5.4.260.0080.02316.13
5.4.250.0030.02516.12
5.4.240.0040.02316.18
5.4.230.0020.02516.13
5.4.220.0070.04216.13
5.4.210.0040.04216.27
5.4.200.0060.03616.24
5.4.190.0080.02716.08
5.4.180.0020.03716.18
5.4.170.0050.03316.14
5.4.160.0060.03016.24
5.4.150.0070.04016.13
5.4.140.0030.04214.87
5.4.130.0090.03414.85
5.4.120.0000.03114.83
5.4.110.0080.03514.88
5.4.100.0040.03114.83
5.4.90.0010.03114.75
5.4.80.0010.02514.83
5.4.70.0030.02814.80
5.4.60.0020.03714.72
5.4.50.0030.04014.81
5.4.40.0020.02714.82
5.4.30.0070.03714.76
5.4.20.0070.03814.84
5.4.10.0050.03714.74
5.4.00.0050.02414.45
5.3.290.0020.04313.98
5.3.280.0080.04013.93
5.3.270.0020.02813.90
5.3.260.0030.04313.94
5.3.250.0030.04513.92
5.3.240.0090.02813.93
5.3.230.0030.03614.02
5.3.220.0060.04013.91
5.3.210.0110.03313.90
5.3.200.0050.04013.92
5.3.190.0050.03213.88
5.3.180.0070.02313.90
5.3.170.0050.03013.90
5.3.160.0100.03414.00
5.3.150.0030.04014.00
5.3.140.0050.02913.91
5.3.130.0020.02514.00
5.3.120.0060.02013.87
5.3.110.0060.04113.91
5.3.100.0030.04413.66
5.3.90.0080.03813.63
5.3.80.0020.03013.63
5.3.70.0050.02313.67
5.3.60.0030.03913.54
5.3.50.0010.02513.62
5.3.40.0050.02013.69
5.3.30.0030.02013.52
5.3.20.0020.02213.58
5.3.10.0030.02013.47
5.3.00.0050.02513.38
5.2.170.0030.03011.16
5.2.160.0030.02711.17
5.2.150.0030.03311.23
5.2.140.0000.03311.14
5.2.130.0030.02711.15
5.2.120.0000.03011.11
5.2.110.0100.02311.32
5.2.100.0000.03711.16
5.2.90.0000.03011.14
5.2.80.0000.03011.14
5.2.70.0000.04311.16
5.2.60.0000.03011.10
5.2.50.0030.03011.09
5.2.40.0000.03310.85
5.2.30.0000.03011.02
5.2.20.0070.02311.02
5.2.10.0030.02710.83
5.2.00.0000.03710.63
5.1.60.0030.02010.07
5.1.50.0030.0209.97
5.1.40.0000.02710.04
5.1.30.0000.02710.39
5.1.20.0030.02310.35
5.1.10.0030.02310.07
5.1.00.0000.02710.04
5.0.50.0000.0278.87
5.0.40.0070.0178.87
5.0.30.0000.0308.87
5.0.20.0000.0208.87
5.0.10.0000.0208.87
5.0.00.0000.0308.87
4.4.90.0000.0178.87
4.4.80.0070.0108.87
4.4.70.0000.0178.87
4.4.60.0030.0138.87
4.4.50.0000.0178.87
4.4.40.0000.0238.87
4.4.30.0000.0178.87
4.4.20.0000.0138.87
4.4.10.0000.0138.87
4.4.00.0030.0208.87
4.3.110.0000.0138.87
4.3.100.0000.0208.87
4.3.90.0000.0138.87
4.3.80.0000.0278.87
4.3.70.0000.0138.87
4.3.60.0000.0138.87
4.3.50.0000.0138.87
4.3.40.0000.0238.87
4.3.30.0000.0138.87
4.3.20.0000.0178.87
4.3.10.0030.0138.87
4.3.00.0000.0138.87

preferences:
45.46 ms | 401 KiB | 5 Q