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')); } } $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.0170.00316.63
8.3.50.0150.00522.04
8.3.40.0040.01118.73
8.3.30.0070.00719.27
8.3.20.0120.00619.99
8.3.10.0030.00523.69
8.3.00.0080.00020.80
8.2.180.0090.00618.29
8.2.170.0120.00322.96
8.2.160.0070.01020.29
8.2.150.0040.00424.18
8.2.140.0100.00724.66
8.2.130.0050.00326.16
8.2.120.0000.00820.83
8.2.110.0100.00022.30
8.2.100.0070.00719.03
8.2.90.0000.00817.75
8.2.80.0040.00417.97
8.2.70.0050.00317.93
8.2.60.0000.00817.93
8.2.50.0030.00518.10
8.2.40.0000.00822.32
8.2.30.0000.00718.13
8.2.20.0080.00017.66
8.2.10.0080.00018.13
8.2.00.0040.00417.65
8.1.280.0070.00725.92
8.1.270.0080.00022.18
8.1.260.0050.00226.35
8.1.250.0080.00028.09
8.1.240.0030.00622.14
8.1.230.0060.00619.14
8.1.220.0000.00817.79
8.1.210.0040.00418.77
8.1.200.0030.00617.34
8.1.190.0000.00817.35
8.1.180.0070.00318.10
8.1.170.0000.00918.56
8.1.160.0000.00721.97
8.1.150.0070.00018.55
8.1.140.0000.00717.47
8.1.130.0000.00717.84
8.1.120.0050.00217.45
8.1.110.0050.00317.34
8.1.100.0040.00417.48
8.1.90.0040.00417.45
8.1.80.0000.00717.50
8.1.70.0030.00317.34
8.1.60.0000.00817.57
8.1.50.0080.00017.49
8.1.40.0050.00317.42
8.1.30.0000.00817.57
8.1.20.0040.00417.59
8.1.10.0070.00017.46
8.1.00.0030.00617.52
8.0.300.0040.00419.66
8.0.290.0000.00816.88
8.0.280.0040.00418.39
8.0.270.0000.00817.18
8.0.260.0080.00017.22
8.0.250.0030.00317.07
8.0.240.0030.00316.98
8.0.230.0040.00416.90
8.0.220.0000.00716.87
8.0.210.0000.00717.00
8.0.200.0000.00717.06
8.0.190.0040.00416.93
8.0.180.0040.00416.87
8.0.170.0020.00516.93
8.0.160.0040.00416.99
8.0.150.0000.00716.89
8.0.140.0050.00516.98
8.0.130.0000.00613.43
8.0.120.0030.00516.89
8.0.110.0070.00016.93
8.0.100.0040.00416.94
8.0.90.0000.00716.82
8.0.80.0090.00617.00
8.0.70.0030.00516.99
8.0.60.0000.00716.75
8.0.50.0040.00417.02
8.0.30.0140.00716.95
8.0.20.0130.00517.40
8.0.10.0000.00717.00
8.0.00.0110.00616.89
7.4.330.0060.00015.03
7.4.320.0060.00016.64
7.4.300.0070.00016.40
7.4.290.0030.00316.63
7.4.280.0030.00616.45
7.4.270.0000.00816.53
7.4.260.0000.00716.59
7.4.250.0040.00416.49
7.4.240.0040.00416.65
7.4.230.0040.00416.71
7.4.220.0080.00716.48
7.4.210.0080.00916.61
7.4.200.0000.00716.56
7.4.190.0000.00716.56
7.4.160.0130.00316.52
7.4.150.0080.01117.40
7.4.140.0140.00517.86
7.4.130.0080.01216.53
7.4.120.0080.01116.57
7.4.110.0060.01116.53
7.4.100.0060.01016.45
7.4.90.0060.00916.63
7.4.80.0060.01219.39
7.4.70.0140.00316.46
7.4.60.0090.00916.65
7.4.50.0060.00316.27
7.4.40.0090.01216.49
7.4.30.0070.01416.46
7.4.00.0130.00315.19
7.3.330.0000.00613.24
7.3.320.0050.00013.21
7.3.310.0000.00716.35
7.3.300.0030.00316.34
7.3.290.0090.00616.37
7.3.280.0100.00916.40
7.3.270.0080.00817.40
7.3.260.0170.00816.63
7.3.250.0120.00516.42
7.3.240.0030.01316.46
7.3.230.0100.00716.43
7.3.210.0130.00416.39
7.3.200.0090.00616.53
7.3.190.0080.01316.40
7.3.180.0030.01316.37
7.3.170.0030.01416.42
7.3.160.0060.00916.48
7.3.120.0040.01114.84
7.2.330.0140.00416.57
7.2.320.0030.01316.86
7.2.310.0030.01316.81
7.2.300.0090.01216.32
7.2.290.0090.00916.50
7.2.00.0060.00619.51
7.1.100.0060.00618.35
7.1.70.0000.00816.93
7.1.60.0120.01219.46
7.1.50.0130.01016.81
7.1.00.0130.06022.39
7.0.200.0090.00416.60
7.0.140.0000.07722.13
7.0.60.0070.04319.78
7.0.50.0100.05317.84
7.0.40.0170.03320.09
7.0.30.0270.08320.37
7.0.20.0200.06320.15
7.0.10.0070.08720.15
7.0.00.0070.08320.25
5.6.280.0030.07721.16
5.6.210.0070.03720.71
5.6.200.0030.08318.22
5.6.190.0000.05020.55
5.6.180.0000.08720.60
5.6.170.0300.04320.54
5.6.160.0100.04020.54
5.6.150.0030.05018.25
5.6.140.0070.07718.28
5.6.130.0030.05718.21
5.6.120.0000.06321.03
5.6.110.0030.08020.99
5.6.100.0070.06721.11
5.6.90.0030.06720.98
5.6.80.0030.03720.44
5.5.350.0030.07720.39
5.5.340.0030.06017.94
5.5.330.0070.08320.32
5.5.320.0300.04320.35
5.5.310.0230.04320.36
5.5.300.0100.04317.94
5.5.290.0070.04317.98
5.5.280.0070.08320.80
5.5.270.0130.07320.77
5.5.260.0100.09020.88
5.5.250.0100.08320.79
5.5.240.0030.04020.27
5.4.450.0770.07319.47
5.4.440.0730.06319.59
5.4.430.0870.05319.30
5.4.420.0700.06019.70
5.4.410.0700.07719.38
5.4.400.1200.06319.15
5.4.390.0870.04319.01
5.4.380.0330.05718.48
5.4.370.0270.05318.48
5.4.360.0370.06318.48
5.4.350.0200.07018.76
5.4.340.0370.04718.50
5.4.320.0080.03312.50
5.4.310.0070.04412.50
5.4.300.0050.03612.50
5.4.290.0050.05612.50
5.4.280.0080.03612.39
5.4.270.0080.03812.40
5.4.260.0110.04612.40
5.4.250.0070.05512.39
5.4.240.0090.05812.39
5.4.230.0070.04812.39
5.4.220.0050.04412.39
5.4.210.0070.03512.39
5.4.200.0060.03812.39
5.4.190.0060.03712.38
5.4.180.0080.03612.39
5.4.170.0050.03712.40
5.4.160.0100.03312.39
5.4.150.0090.03412.39
5.4.140.0080.04312.07
5.4.130.0060.05212.06
5.4.120.0100.04612.02
5.4.110.0030.04012.02
5.4.100.0060.03712.02
5.4.90.0170.05212.01
5.4.80.0070.03812.01
5.4.70.0100.03912.01
5.4.60.0060.04212.01
5.4.50.0090.05312.01
5.4.40.0100.03812.00
5.4.30.0100.04912.00
5.4.20.0090.05112.00
5.4.10.0090.05412.00
5.4.00.0050.05411.49
5.3.290.0090.04012.80
5.3.280.0070.03912.70
5.3.270.0060.04012.72
5.3.260.0060.04112.72
5.3.250.0060.03912.72
5.3.240.0090.03612.72
5.3.230.0080.04212.71
5.3.220.0030.04012.68
5.3.210.0100.03612.68
5.3.200.0050.04012.68
5.3.190.0060.03912.68
5.3.180.0050.03912.67
5.3.170.0070.06112.67
5.3.160.0080.03812.67
5.3.150.0060.04012.68
5.3.140.0050.03912.66
5.3.130.0070.04012.66
5.3.120.0050.04212.66
5.3.110.0120.03512.65
5.3.100.0040.04012.12
5.3.90.0080.04412.11
5.3.80.0080.04312.10
5.3.70.0080.04112.10
5.3.60.0110.03612.08
5.3.50.0080.04412.04
5.3.40.0090.04212.03
5.3.30.0060.05111.99
5.3.20.0100.04611.78
5.3.10.0080.05011.74
5.3.00.0070.05311.72
5.2.170.0080.0439.23
5.2.160.0070.0579.23
5.2.150.0100.0459.23
5.2.140.0060.0359.22
5.2.130.0090.0419.18
5.2.120.0100.0479.18
5.2.110.0100.0489.19
5.2.100.0090.0599.19
5.2.90.0060.0339.18
5.2.80.0080.0449.18
5.2.70.0070.0309.18
5.2.60.0080.0309.13
5.2.50.0100.0349.11
5.2.40.0060.0299.08
5.2.30.0060.0319.06
5.2.20.0060.0289.05
5.2.10.0080.0278.95
5.2.00.0070.0318.81
5.1.60.0160.0888.09
5.1.50.0150.0458.09
5.1.40.0050.0328.08
5.1.30.0110.0638.42
5.1.20.0050.0418.45
5.1.10.0050.0318.17
5.1.00.0050.0318.17
5.0.50.0060.0246.65
5.0.40.0060.0256.50
5.0.30.0110.0466.33
5.0.20.0160.0536.29
5.0.10.0080.0266.27
5.0.00.0020.0386.26
4.4.90.0050.0154.78
4.4.80.0030.0164.75
4.4.70.0010.0244.76
4.4.60.0050.0194.75
4.4.50.0040.0154.77
4.4.40.0020.0294.71
4.4.30.0020.0184.76
4.4.20.0040.0164.84
4.4.10.0020.0204.85
4.4.00.0070.0234.76
4.3.110.0050.0264.67
4.3.100.0140.0294.66
4.3.90.0010.0184.63
4.3.80.0020.0394.59
4.3.70.0060.0284.63
4.3.60.0070.0344.63
4.3.50.0080.0404.63
4.3.40.0040.0344.53
4.3.30.0020.0243.30
4.3.20.0040.0213.28
4.3.10.0010.0223.23
4.3.00.0130.0336.94

preferences:
42.4 ms | 401 KiB | 5 Q