3v4l.org

run code in 300+ PHP versions simultaneously
<?php function &readPrivate($object, $k, $context = null) { if (null === $context) { $context = $object; } $closure = function & () use ($k) { return $this->$k; }; $binding = Closure::bind( $closure, $object, $context); $value = & $binding->__invoke(); return $value; } class B { private $xb = 'xb_b'; private $x = 'xb'; public $z = 'zb'; } class C extends B { private $x = 'xc'; private $y = 'yc'; public $z = 'zc'; } $c = new C; var_dump(readPrivate($c, 'x')); var_dump(readPrivate($c, 'x', B::class)); var_dump(readPrivate($c, 'x', ReflectionClass::class));

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.5.10.0120.00616.84
8.5.00.0210.01520.36
8.4.150.0010.00114.05
8.4.140.0100.01117.82
8.4.130.0140.00717.91
8.4.120.0110.00920.93
8.4.110.0120.00822.82
8.4.100.0050.00418.14
8.4.90.0120.00920.52
8.4.80.0050.00318.77
8.4.70.0070.01220.44
8.4.60.0100.00620.62
8.4.50.0120.00918.77
8.4.40.0090.01219.51
8.4.30.0180.00317.86
8.4.20.0130.00619.72
8.4.10.0130.00318.89
8.3.280.0020.00014.05
8.3.270.0120.00816.66
8.3.260.0120.00916.93
8.3.250.0040.00520.84
8.3.240.0080.00216.85
8.3.230.0090.00116.79
8.3.220.0040.00419.11
8.3.210.0120.00916.86
8.3.200.0040.00516.84
8.3.190.0040.00417.00
8.3.180.0110.00719.12
8.3.170.0100.01018.98
8.3.160.0000.01917.01
8.3.150.0130.00717.29
8.3.140.0110.00616.82
8.3.130.0090.00618.41
8.3.120.0060.00320.75
8.3.110.0060.01020.94
8.3.100.0030.00524.06
8.3.90.0030.00726.77
8.3.80.0040.00818.43
8.3.70.0130.00318.68
8.3.60.0080.00818.56
8.3.50.0050.00818.27
8.3.40.0040.01118.91
8.3.30.0080.00818.84
8.3.20.0040.00421.90
8.3.10.0040.00423.46
8.3.00.0050.00317.93
8.2.290.0110.00916.60
8.2.280.0120.00818.62
8.2.270.0030.01617.29
8.2.260.0070.01016.68
8.2.250.0080.00018.50
8.2.240.0050.00317.42
8.2.230.0070.00422.58
8.2.220.0000.01037.54
8.2.210.0050.00326.77
8.2.200.0030.00616.63
8.2.190.0070.01416.60
8.2.180.0090.00916.50
8.2.170.0040.01122.96
8.2.160.0130.00020.39
8.2.150.0000.00824.18
8.2.140.0060.00324.66
8.2.130.0050.00319.27
8.2.120.0000.00826.35
8.2.110.0000.00921.05
8.2.100.0060.00618.03
8.2.90.0000.00817.91
8.2.80.0040.00419.16
8.2.70.0000.00817.93
8.2.60.0000.00817.92
8.2.50.0060.00318.10
8.2.40.0080.00020.55
8.2.30.0040.00419.45
8.2.20.0040.00417.99
8.2.10.0050.00318.01
8.2.00.0040.00418.03
8.1.330.0100.00916.57
8.1.320.0060.00816.33
8.1.310.0030.00616.78
8.1.300.0120.00620.25
8.1.290.0060.00330.84
8.1.280.0060.00925.92
8.1.270.0040.00423.96
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0090.00022.02
8.1.230.0080.00421.02
8.1.220.0040.00417.79
8.1.210.0040.00418.77
8.1.200.0040.00417.35
8.1.190.0060.00317.23
8.1.180.0040.00418.10
8.1.170.0000.00918.64
8.1.160.0000.00718.87
8.1.150.0000.00719.04
8.1.140.0000.00717.78
8.1.130.0030.00319.03
8.1.120.0040.00417.48
8.1.110.0000.00717.44
8.1.100.0070.00017.49
8.1.90.0000.00817.48
8.1.80.0040.00417.34
8.1.70.0000.00817.36
8.1.60.0080.00017.61
8.1.50.0030.00617.42
8.1.40.0000.00717.45
8.1.30.0040.00417.66
8.1.20.0030.00717.67
8.1.10.0070.00317.66
8.1.00.0050.00217.57
8.0.300.0000.00820.14
8.0.290.0050.00216.75
8.0.280.0000.00718.38
8.0.270.0000.00717.18
8.0.260.0060.00017.28
8.0.250.0000.00717.05
8.0.240.0070.00017.05
8.0.230.0020.00517.03
8.0.220.0030.00316.98
8.0.210.0000.00816.86
8.0.200.0000.00816.95
8.0.190.0030.00617.02
8.0.180.0040.00416.97
8.0.170.0060.00317.04
8.0.160.0000.00716.84
8.0.150.0040.00416.88
8.0.140.0070.00016.82
8.0.130.0000.00613.48
8.0.120.0040.00416.97
8.0.110.0000.00816.93
8.0.100.0030.00516.98
8.0.90.0070.00016.86
8.0.80.0060.00916.92
8.0.70.0000.00817.03
8.0.60.0050.00316.88
8.0.50.0070.00016.99
8.0.30.0090.00917.13
8.0.20.0120.00717.40
8.0.10.0080.00017.15
8.0.00.0090.00816.98
7.4.330.0000.00515.55
7.4.320.0060.00016.60
7.4.300.0000.00616.63
7.4.290.0020.00516.54
7.4.280.0000.00716.63
7.4.270.0000.00916.61
7.4.260.0000.00716.63
7.4.250.0030.00516.46
7.4.240.0040.00416.61
7.4.230.0000.00716.43
7.4.220.0040.00416.57
7.4.210.0070.01316.58
7.4.200.0070.00016.43
7.4.160.0090.00816.56
7.4.140.0090.01217.86
7.4.130.0100.00716.52
7.4.120.0120.00816.55
7.4.110.0100.00716.59
7.4.100.0150.00416.59
7.4.90.0060.01116.51
7.4.80.0070.01719.39
7.4.70.0060.01016.54
7.4.60.0090.00616.65
7.4.50.0070.01016.69
7.4.40.0000.01616.64
7.4.10.0090.00914.95
7.4.00.0100.00515.14
7.3.330.0050.00013.43
7.3.320.0030.00313.39
7.3.310.0000.00716.52
7.3.300.0050.00216.40
7.3.290.0070.00016.48
7.3.280.0070.00716.41
7.3.260.0100.01016.46
7.3.240.0080.00916.58
7.3.230.0030.01416.63
7.3.210.0180.00816.61
7.3.200.0120.01116.48
7.3.190.0250.01016.52
7.3.180.0000.01516.46
7.3.170.0070.01016.38
7.3.160.0100.00716.45
7.3.130.0100.01014.96
7.3.120.0120.00614.91
7.3.110.0130.00715.13
7.3.100.0070.00715.02
7.3.90.0030.01014.91
7.3.80.0030.01214.94
7.3.70.0040.01114.67
7.3.60.0040.01114.92
7.3.50.0030.01014.82
7.3.40.0040.01114.69
7.3.30.0040.00714.63
7.3.20.0030.00916.62
7.3.10.0000.01316.66
7.3.00.0000.01316.88
7.2.330.0140.00416.64
7.2.320.0110.01416.71
7.2.310.0030.01416.76
7.2.300.0110.01216.70
7.2.290.0030.01516.46
7.2.260.0030.01715.27
7.2.250.0100.01015.00
7.2.240.0030.01214.81
7.2.230.0000.01415.19
7.2.220.0040.00814.88
7.2.210.0000.01415.07
7.2.200.0070.01015.20
7.2.190.0060.00614.73
7.2.180.0080.00414.92
7.2.170.0040.01115.11
7.2.160.0030.00914.96
7.2.150.0000.01216.86
7.2.140.0000.01216.99
7.2.130.0110.00717.02
7.2.120.0030.01317.01
7.2.110.0030.00917.11
7.2.100.0030.01016.70
7.2.90.0040.01117.11
7.2.80.0090.00617.03
7.2.70.0060.00317.13
7.2.60.0060.00616.63
7.2.50.0090.00516.93
7.2.40.1010.00917.36
7.2.30.0590.01117.41
7.2.20.0390.01217.29
7.2.10.0450.01017.37
7.2.00.0520.01517.56
7.1.330.0040.01115.92
7.1.320.0040.01116.00
7.1.310.0030.00915.93
7.1.300.0040.00715.90
7.1.290.0090.00615.59
7.1.280.0030.00615.88
7.1.270.0000.01015.84
7.1.260.0030.00815.79
7.1.250.0030.01015.84
7.1.240.0030.01015.81
7.1.230.0120.00315.91
7.1.220.0080.00815.58
7.1.210.0080.00615.78
7.1.200.0070.00915.68
7.1.190.0030.01215.96
7.1.180.0030.00515.88
7.1.170.0000.01115.57
7.1.160.0510.01216.42
7.1.150.0510.01316.32
7.1.140.0380.00816.41
7.1.130.0570.01016.36
7.1.120.0570.00716.31
7.1.110.0490.01216.08
7.1.100.0580.01916.21
7.1.90.0490.01016.02
7.1.80.0400.00715.96
7.1.70.0380.00715.57
7.1.60.0580.01124.59
7.1.50.0650.01524.38
7.1.40.0620.01124.07
7.1.30.0670.01624.18
7.1.20.0640.01524.33
7.1.10.0690.01015.20
7.1.00.0640.01015.19
7.0.330.0060.00915.32
7.0.320.0030.00615.35
7.0.310.0030.01015.44
7.0.300.0090.00615.22
7.0.290.0040.00815.51
7.0.280.0080.00515.57
7.0.270.0080.00415.35
7.0.260.0060.00615.19
7.0.250.0040.00815.29
7.0.240.0030.00915.52
7.0.230.0110.00315.50
7.0.220.0030.00715.13
7.0.210.0040.01115.57
7.0.200.0080.00315.48
7.0.190.0060.00315.32
7.0.180.0100.00315.39
7.0.170.0080.00415.59
7.0.160.0070.00715.61
7.0.150.0030.01315.56
7.0.140.0100.00715.25
7.0.130.0100.00015.36
7.0.120.0040.00815.48
7.0.110.0060.00315.30
7.0.100.0030.00915.45
7.0.90.0000.01015.43
7.0.80.0080.00315.24
7.0.70.0060.00615.16
7.0.60.0000.01715.44
7.0.50.0060.00615.56
7.0.40.0000.01113.49
7.0.30.0000.01513.57
7.0.20.0090.00613.40
7.0.10.0040.01513.27
7.0.00.0070.00713.56
5.6.400.0040.00814.34
5.6.390.0030.01214.20
5.6.380.0000.01414.29
5.6.370.0100.00314.37
5.6.360.0090.00614.00
5.6.350.0070.00714.46
5.6.340.0070.00714.20
5.6.330.0030.00914.27
5.6.320.0040.01214.50
5.6.310.0000.00814.57
5.6.300.0070.00714.23
5.6.290.0040.01414.33
5.6.280.0000.01014.43
5.6.270.0060.00614.44
5.6.260.0080.00614.23
5.6.250.0070.00314.50
5.6.240.0060.00614.60
5.6.230.0040.00414.37
5.6.220.0070.00314.20
5.6.210.0030.00514.42
5.6.200.0040.00814.23
5.6.190.0070.00714.36
5.6.180.0090.00914.54
5.6.170.0040.00814.09
5.6.160.0070.01014.41
5.6.150.0030.01314.59
5.6.140.0090.00914.27
5.6.130.0030.00914.09
5.6.120.0030.00914.39
5.6.110.0090.00614.41
5.6.100.0070.00314.28
5.6.90.0000.00914.32
5.6.80.0130.00314.45
5.6.70.0030.01314.07
5.6.60.0030.01414.40
5.6.50.0100.00614.06
5.6.40.0060.00913.98
5.6.30.0000.01014.16
5.6.20.0040.00814.22
5.6.10.0030.01014.37
5.6.00.0110.00414.30

preferences:
192.86 ms | 403 KiB | 5 Q