3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Access a property with no restrictions function stole($object,$property){ $dict = (array)$object; $class = get_class($object); return isset($dict[$property])? $dict[$property]:(isset($dict["\0*\0$property"])? $dict["\0*\0$property"]:(isset($dict["\0$class\0$property"])? $dict["\0$class\0$property"]:null)); } // Modify a property with no restrictions function inject(&$object,$property,$value){ $dict = (array)$object; $class = get_class($object); if (isset($dict["\0$class\0$property"])) { $dict["\0$class\0$property"] = $value; $object = castToClass($dict,$class); } elseif (isset($dict["\0*\0$property"])) { $dict["\0*\0$property"] = $value; $object = castToClass($dict,$class); } elseif (isset($dict[$property])) { $object->$property = $value; } else { return ; } } // Required because we don't know if className has a __set_state defined. function castToClass(array $array,$className) { return unserialize( 'O:'.strlen($className).':"' .$className.'"'.strstr(serialize($array), ':') ); } // Example class Safe { private $content = 'gold'; } $mySafe = new Safe(); // Inject value into a private property inject($mySafe,'content','Magic!'); echo "I've robbed your ",stole($mySafe,'content'),"!";

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.0070.00718.55
8.3.50.0120.00321.86
8.3.40.0120.00318.80
8.3.30.0070.00719.18
8.3.20.0070.00020.35
8.3.10.0040.00423.30
8.3.00.0080.00017.89
8.2.180.0070.01116.63
8.2.170.0070.00722.96
8.2.160.0130.00720.39
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0070.00020.97
8.2.110.0040.00422.24
8.2.100.0040.00717.91
8.2.90.0060.00319.22
8.2.80.0040.00417.97
8.2.70.0030.00617.63
8.2.60.0040.00418.04
8.2.50.0000.00818.07
8.2.40.0080.00018.22
8.2.30.0050.00518.42
8.2.20.0000.00817.85
8.2.10.0050.00218.07
8.2.00.0040.00417.79
8.1.280.0070.01025.92
8.1.270.0040.00423.79
8.1.260.0050.00326.35
8.1.250.0070.00028.09
8.1.240.0030.00623.69
8.1.230.0080.00319.21
8.1.220.0050.00317.74
8.1.210.0080.00018.77
8.1.200.0030.00617.48
8.1.190.0050.00317.38
8.1.180.0030.00518.10
8.1.170.0000.00818.51
8.1.160.0000.00721.97
8.1.150.0000.00818.96
8.1.140.0000.00717.54
8.1.130.0040.00417.93
8.1.120.0030.00417.50
8.1.110.0050.00317.38
8.1.100.0070.00017.40
8.1.90.0000.00717.54
8.1.80.0000.00817.50
8.1.70.0070.00017.47
8.1.60.0000.00917.52
8.1.50.0060.00317.56
8.1.40.0040.00417.58
8.1.30.0060.00317.75
8.1.20.0050.00317.64
8.1.10.0040.00417.58
8.1.00.0050.00317.48
8.0.300.0070.00018.77
8.0.290.0030.00616.75
8.0.280.0000.00718.41
8.0.270.0000.00717.29
8.0.260.0070.00017.21
8.0.250.0000.00717.06
8.0.240.0070.00417.04
8.0.230.0030.00317.11
8.0.220.0070.00017.02
8.0.210.0030.00316.91
8.0.200.0000.00717.08
8.0.190.0000.00817.11
8.0.180.0040.00416.95
8.0.170.0040.00417.03
8.0.160.0000.00716.92
8.0.150.0000.00716.92
8.0.140.0060.01216.83
8.0.130.0040.00413.39
8.0.120.0030.00516.98
8.0.110.0000.00816.92
8.0.100.0070.00017.11
8.0.90.0070.00017.02
8.0.80.0080.00617.06
8.0.70.0000.00716.84
8.0.60.0000.00816.96
8.0.50.0040.00416.86
8.0.30.0080.01217.13
8.0.20.0160.00417.40
8.0.10.0040.00416.88
8.0.00.0090.00916.95
7.4.330.0000.00615.00
7.4.320.0060.00016.45
7.4.300.0040.00416.65
7.4.290.0030.00316.54
7.4.280.0040.00416.55
7.4.270.0000.00716.55
7.4.260.0060.00316.57
7.4.250.0040.00416.51
7.4.240.0040.00416.54
7.4.230.0000.00716.75
7.4.220.0130.00816.64
7.4.210.0000.01416.60
7.4.200.0050.00216.53
7.4.160.0070.01016.60
7.4.150.0040.01717.40
7.4.140.0130.01017.86
7.4.130.0130.00316.59
7.4.120.0110.01016.67
7.4.110.0150.00316.57
7.4.100.0110.00616.64
7.4.90.0110.00716.43
7.4.80.0140.00719.39
7.4.70.0100.00616.54
7.4.60.0070.01316.51
7.4.50.0000.00516.44
7.4.40.0030.01316.31
7.4.30.0100.00616.54
7.4.00.0040.01115.09
7.3.330.0060.00013.40
7.3.320.0000.00513.23
7.3.310.0040.00416.48
7.3.300.0040.00416.37
7.3.290.0060.00916.41
7.3.280.0100.00816.41
7.3.270.0090.00917.40
7.3.260.0130.00416.43
7.3.250.0100.00616.58
7.3.240.0060.01616.41
7.3.230.0060.01116.54
7.3.210.0030.01616.63
7.3.200.0130.00319.39
7.3.190.0060.01216.52
7.3.180.0100.00716.62
7.3.170.0030.01516.59
7.3.160.0100.01016.66
7.3.120.0060.00614.87
7.2.330.0100.01316.58
7.2.320.0070.01016.78
7.2.310.0090.00616.74
7.2.300.0110.01116.75
7.2.290.0120.00616.78
7.1.70.0000.01117.38
7.1.60.0100.01619.70
7.1.50.0120.00916.78
7.1.00.0000.07722.33
7.0.200.2540.00316.69
7.0.140.0030.07322.00
7.0.60.0230.06720.05
7.0.50.0100.04017.98
7.0.40.0100.03720.21
7.0.30.0330.07720.16
7.0.20.0070.05020.25
7.0.10.0070.06720.21
7.0.00.0100.03720.32
5.6.280.0000.07721.04
5.6.210.0070.08320.71
5.6.200.0100.06718.21
5.6.190.0070.07320.67
5.6.180.0170.06320.48
5.6.170.0200.04020.56
5.6.160.0070.08320.45
5.6.150.0170.07318.23
5.6.140.0100.07718.23
5.6.130.0100.08018.27
5.6.120.0070.05321.00
5.6.110.0030.08021.04
5.6.100.0130.07721.04
5.6.90.0070.08320.94
5.6.80.0070.08020.41
5.5.350.0270.08020.36
5.5.340.0130.05017.94
5.5.330.0100.08020.40
5.5.320.0200.04720.20
5.5.310.0430.07320.31
5.5.300.0130.07318.04
5.5.290.0030.05718.07
5.5.280.0000.08720.89
5.5.270.0170.07720.84
5.5.260.0030.05020.78
5.5.250.0100.06320.79
5.5.240.0030.03020.27
5.4.450.0800.05319.62
5.4.440.0170.06019.48
5.4.430.0130.05719.33
5.4.420.0170.05019.47
5.4.410.0130.05018.81
5.4.400.0330.05018.55
5.4.390.0230.06018.85
5.4.380.0170.06718.62
5.4.370.0170.04318.63
5.4.360.0170.04318.58
5.4.350.0060.03612.02
5.4.340.0040.03912.02
5.4.320.0060.03612.52
5.4.310.0070.03812.52
5.4.300.0080.03512.52
5.4.290.0070.03712.52
5.4.280.0050.03712.41
5.4.270.0070.03612.41
5.4.260.0090.03612.41
5.4.250.0050.04012.41
5.4.240.0110.04312.41
5.4.230.0070.03712.40
5.4.220.0040.03712.40
5.4.210.0080.03312.40
5.4.200.0060.03712.40
5.4.190.0040.03812.40
5.4.180.0080.03412.39
5.4.170.0060.03612.41
5.4.160.0070.03512.40
5.4.150.0070.03512.39
5.4.140.0040.03812.08
5.4.130.0070.03312.07
5.4.120.0030.04012.03
5.4.110.0050.03912.03
5.4.100.0040.03812.03
5.4.90.0030.04112.03
5.4.80.0060.03812.03
5.4.70.0080.03312.02
5.4.60.0050.03512.02
5.4.50.0060.03512.02
5.4.40.0070.03312.01
5.4.30.0050.03712.00
5.4.20.0050.03612.00
5.4.10.0060.03412.00
5.4.00.0040.03811.50
5.3.290.0050.05212.80
5.3.280.0030.04012.71
5.3.270.0080.03812.72
5.3.260.0050.04012.72
5.3.250.0050.03912.71
5.3.240.0090.04112.72
5.3.230.0100.04912.71
5.3.220.0090.04012.68
5.3.210.0070.03912.68
5.3.200.0060.03512.68
5.3.190.0060.03612.68
5.3.180.0060.03512.68
5.3.170.0080.03312.67
5.3.160.0040.03812.68
5.3.150.0050.03812.67
5.3.140.0100.03212.66
5.3.130.0080.03712.66
5.3.120.0060.03912.65
5.3.110.0050.03912.66
5.3.100.0040.03912.13
5.3.90.0040.03812.11
5.3.80.0060.03812.11
5.3.70.0020.04112.11
5.3.60.0050.04212.09
5.3.50.0080.04212.04
5.3.40.0020.04112.04
5.3.30.0030.03812.01
5.3.20.0060.03711.78
5.3.10.0050.03711.75
5.3.00.0060.03511.75
5.2.170.0030.0329.24
5.2.160.0060.0279.25
5.2.150.0020.0329.24
5.2.140.0040.0309.24
5.2.130.0050.0289.20
5.2.120.0020.0329.20
5.2.110.0040.0309.21
5.2.100.0030.0309.20
5.2.90.0060.0299.20
5.2.80.0050.0319.20
5.2.70.0040.0319.20
5.2.60.0050.0309.16
5.2.50.0080.0339.13
5.2.40.0070.0349.10
5.2.30.0060.0289.07
5.2.20.0040.0349.06
5.2.10.0040.0308.96
5.2.00.0020.0318.83
5.1.60.0040.0248.11
5.1.50.0050.0248.11
5.1.40.0030.0258.09
5.1.30.0040.0268.44
5.1.20.0060.0258.46
5.1.10.0050.0258.19
5.1.00.0080.0328.19
5.0.50.0050.0216.68
5.0.40.0020.0216.53
5.0.30.0040.0306.34
5.0.20.0020.0226.31
5.0.10.0030.0216.29
5.0.00.0020.0326.28
4.4.90.0030.0154.78
4.4.80.0050.0194.75
4.4.70.0020.0174.75
4.4.60.0030.0164.75
4.4.50.0040.0144.77
4.4.40.0030.0304.71
4.4.30.0020.0174.75
4.4.20.0050.0134.84
4.4.10.0010.0184.85
4.4.00.0030.0254.76
4.3.110.0030.0164.67
4.3.100.0030.0154.66
4.3.90.0070.0104.63
4.3.80.0000.0274.59
4.3.70.0020.0174.63
4.3.60.0040.0174.62
4.3.50.0020.0164.63
4.3.40.0020.0244.54
4.3.30.0010.0173.34
4.3.20.0040.0143.31
4.3.10.0070.0123.27
4.3.00.0130.0277.11

preferences:
75.85 ms | 401 KiB | 5 Q