3v4l.org

run code in 300+ PHP versions simultaneously
<?php function &readPrivate($object, $k, $context = null) { $closure = function & () use ($k) { return $this->$k; }; $binding = Closure::bind( $closure, $object, $context); $value = & $binding->__invoke(); return $value; } class B { private $x = 'xb'; public $z = 'zb'; } class C { private $x = 'xc'; private $y = 'yc'; public $z = 'zc'; } $c = new C; var_dump(readPrivate($c, 'x', $c)); # var_dump(readPrivate($c, 'x', B::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.0110.00616.66
8.5.00.0110.00920.21
8.4.160.0100.01023.81
8.4.150.0020.00114.05
8.4.140.0130.00817.45
8.4.130.0040.00617.81
8.4.120.0120.00820.52
8.4.110.0100.01018.79
8.4.100.0100.01117.96
8.4.90.0090.01220.77
8.4.80.0040.00318.83
8.4.70.0060.01018.83
8.4.60.0100.01018.84
8.4.50.0120.00818.77
8.4.40.0040.01219.47
8.4.30.0140.00717.64
8.4.20.0170.00317.70
8.4.10.0030.00619.46
8.3.280.0130.00818.50
8.3.270.0170.00216.63
8.3.260.0120.00716.52
8.3.250.0080.01119.08
8.3.240.0150.00416.74
8.3.230.0040.00416.77
8.3.220.0050.00319.08
8.3.210.0070.00520.84
8.3.200.0030.00516.85
8.3.190.0100.00817.32
8.3.180.0080.00218.80
8.3.170.0070.01117.00
8.3.160.0040.00417.43
8.3.150.0160.00319.02
8.3.140.0110.00717.25
8.3.130.0030.00618.24
8.3.120.0060.00318.87
8.3.110.0040.01118.24
8.3.100.0000.00916.51
8.3.90.0120.00326.77
8.3.80.0060.00318.68
8.3.70.0160.00316.75
8.3.60.0090.00918.27
8.3.50.0110.01017.40
8.3.40.0110.00418.47
8.3.30.0070.00718.75
8.3.20.0050.00220.22
8.3.10.0070.00319.15
8.3.00.0060.00319.68
8.2.290.0080.01116.61
8.2.280.0140.00518.75
8.2.270.0030.00620.57
8.2.260.0090.00917.02
8.2.250.0060.00318.36
8.2.240.0050.00518.91
8.2.230.0070.00020.94
8.2.220.0060.00324.06
8.2.210.0070.00726.77
8.2.200.0030.00616.63
8.2.190.0180.00018.28
8.2.180.0100.01025.92
8.2.170.0040.01522.96
8.2.160.0070.00719.07
8.2.150.0070.01124.18
8.2.140.0070.00724.66
8.2.130.0040.00426.16
8.2.120.0060.00320.78
8.2.110.0030.00622.25
8.2.100.0060.00619.45
8.2.90.0030.00617.63
8.2.80.0000.00818.83
8.2.70.0090.00017.50
8.2.60.0090.00018.04
8.2.50.0030.00618.07
8.2.40.0090.00617.83
8.2.30.0040.00418.14
8.2.20.0020.00517.95
8.2.10.0040.00418.14
8.2.00.0020.00518.17
8.1.330.0110.00816.09
8.1.320.0120.00717.58
8.1.310.0040.00416.80
8.1.300.0130.00617.56
8.1.290.0000.00930.84
8.1.280.0120.00625.92
8.1.270.0000.00822.24
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0060.00320.33
8.1.230.0110.00017.83
8.1.220.0040.00417.79
8.1.210.0050.00518.77
8.1.200.0080.00017.35
8.1.190.0050.00317.35
8.1.180.0060.00318.10
8.1.170.0040.00418.69
8.1.160.0000.00718.78
8.1.150.0000.00718.95
8.1.140.0070.00019.54
8.1.130.0000.00718.89
8.1.120.0000.00717.55
8.1.110.0070.00017.37
8.1.100.0030.00617.51
8.1.90.0040.00417.46
8.1.80.0030.00317.38
8.1.70.0030.00317.42
8.1.60.0080.00017.45
8.1.50.0000.00917.46
8.1.40.0090.00017.55
8.1.30.0030.00517.58
8.1.20.0000.00817.72
8.1.10.0000.00817.56
8.1.00.0080.00017.52
8.0.300.0070.00018.77
8.0.290.0040.00416.58
8.0.280.0050.00318.50
8.0.270.0000.00716.82
8.0.260.0000.00720.72
8.0.250.0050.00316.99
8.0.240.0050.00216.91
8.0.230.0030.00516.94
8.0.220.0040.00416.79
8.0.210.0000.00716.87
8.0.200.0030.00316.91
8.0.190.0040.00416.94
8.0.180.0070.00016.95
8.0.170.0080.00316.92
8.0.160.0030.00516.83
8.0.150.0040.00416.86
8.0.140.0000.00816.88
8.0.130.0060.00013.31
8.0.120.0040.00416.86
8.0.110.0040.00416.85
8.0.100.0000.00716.96
8.0.90.0000.00716.95
8.0.80.0130.00316.83
8.0.70.0050.00316.80
8.0.60.0040.00416.96
8.0.50.0040.00416.91
8.0.30.0070.01016.96
8.0.20.0150.00717.40
8.0.10.0000.00716.91
8.0.00.0110.00616.58
7.4.330.0000.00515.55
7.4.320.0060.00016.50
7.4.300.0030.00316.52
7.4.290.0040.00416.53
7.4.280.0040.00416.52
7.4.270.0030.00316.59
7.4.260.0040.00716.59
7.4.250.0040.00416.66
7.4.240.0000.00816.46
7.4.230.0030.00316.46
7.4.220.0100.01016.71
7.4.210.0100.00316.46
7.4.200.0070.00016.53
7.4.160.0090.00616.42
7.4.150.0190.00617.40
7.4.140.0110.00817.86
7.4.130.0070.01316.45
7.4.120.0120.00716.55
7.4.110.0130.00616.57
7.4.100.0070.01116.56
7.4.90.0030.01516.64
7.4.80.0150.00319.39
7.4.70.0120.00816.67
7.4.60.0110.00516.53
7.4.50.0100.00316.43
7.4.40.0100.00716.43
7.4.30.0070.01016.56
7.4.00.0080.00714.81
7.3.330.0000.00513.34
7.3.320.0000.00513.34
7.3.310.0040.00416.24
7.3.300.0030.00316.24
7.3.290.0050.01216.32
7.3.280.0080.00816.35
7.3.270.0090.01017.40
7.3.260.0060.01116.46
7.3.250.0090.00716.43
7.3.240.0110.00716.44
7.3.230.0120.00616.41
7.3.210.0100.00716.40
7.3.200.0160.00316.21
7.3.190.0050.01216.45
7.3.180.0100.00616.25
7.3.170.0040.01316.64
7.3.160.0130.00316.49
7.3.120.0090.00914.78
7.3.110.0050.01114.78
7.3.100.0080.00814.87
7.3.90.0060.00614.81
7.3.80.0030.00715.21
7.3.70.0100.00714.98
7.3.60.0060.00914.82
7.3.50.0060.01314.96
7.3.40.0110.00415.00
7.3.30.0120.00314.74
7.3.20.0040.01116.52
7.3.10.0110.00416.70
7.3.00.0070.00616.64
7.2.330.0070.01116.75
7.2.320.0110.00616.73
7.2.310.0150.00316.79
7.2.300.0080.01116.59
7.2.290.0080.00816.45
7.2.250.0100.01014.58
7.2.240.0090.00915.03
7.2.230.0040.01114.73
7.2.220.0030.01014.61
7.2.210.0030.01014.79
7.2.200.0030.01314.86
7.2.190.0040.01014.98
7.2.180.0130.00615.16
7.2.170.0040.01115.00
7.2.130.0050.00916.81
7.2.120.0090.00416.76
7.2.110.0060.00516.89
7.2.100.0050.00816.91
7.2.90.0050.00716.91
7.2.80.0060.01016.80
7.2.70.0070.00716.82
7.2.60.0060.00616.93
7.2.50.0050.00816.82
7.2.40.0050.00616.77
7.2.30.0080.00516.84
7.2.20.0060.00716.92
7.2.10.0060.00616.98
7.2.00.0020.01216.88
7.1.330.0100.00315.54
7.1.320.0030.00615.70
7.1.310.0030.00615.99
7.1.300.0040.01115.91
7.1.290.0060.00915.98
7.1.280.0070.00715.46
7.1.270.0090.00315.83
7.1.260.0060.00915.91
7.1.250.0050.00515.72
7.1.240.0100.00315.61
7.1.230.0000.01315.89
7.1.220.0110.00315.84
7.1.210.0030.00715.86
7.1.200.0090.00315.81
7.1.190.0000.01015.68
7.1.180.0000.01115.82
7.1.170.0070.00315.53
7.1.160.0030.00615.82
7.1.150.0030.00815.79
7.1.140.0030.01015.76
7.1.130.0000.01115.83
7.1.120.0100.00015.75
7.1.110.0000.00815.90
7.1.100.0070.00415.53
7.1.90.0000.01115.58
7.1.80.0070.00715.79
7.1.70.0080.00316.43
7.1.60.0080.01825.18
7.1.50.0180.01125.47
7.1.40.0130.00925.18
7.1.30.0110.01125.12
7.1.20.0080.01425.01
7.1.10.0080.00516.25
7.1.00.0030.00916.38
7.0.330.0040.01115.36
7.0.320.0080.00315.31
7.0.310.0070.00315.11
7.0.300.0030.00915.33
7.0.290.0000.00915.45
7.0.280.0030.00715.11
7.0.270.0090.00015.18
7.0.260.0090.00315.16
7.0.250.0030.00615.26
7.0.240.0040.00715.16
7.0.230.0000.01315.20
7.0.220.0040.00415.34
7.0.210.0100.00315.37
7.0.200.0030.01016.00
7.0.190.0060.00716.02
7.0.180.0060.00715.89
7.0.170.0020.01015.78
7.0.160.0070.00615.75
7.0.150.0020.00915.66
7.0.140.0050.00915.70
7.0.130.0100.00515.86
7.0.120.0050.01015.91
7.0.110.0050.01015.85
7.0.100.0090.00515.70
7.0.90.0030.00915.74
7.0.80.0030.01115.93
7.0.70.0050.01015.98
7.0.60.0050.00615.74
7.0.50.0060.00815.75
7.0.40.0050.00914.87
7.0.30.0040.01014.92
7.0.20.0030.01214.74
7.0.10.0050.00814.83
7.0.00.0070.00514.84
5.6.380.0030.01014.49

preferences:
37.13 ms | 403 KiB | 5 Q