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.0060.00916.75
8.3.50.0100.00522.05
8.3.40.0120.00618.84
8.3.30.0090.00919.22
8.3.20.0080.00020.17
8.3.10.0000.00823.69
8.3.00.0070.00317.38
8.2.180.0040.01116.63
8.2.170.0110.00422.96
8.2.160.0070.00720.33
8.2.150.0090.00024.18
8.2.140.0030.00524.66
8.2.130.0060.00326.16
8.2.120.0000.00720.85
8.2.110.0100.00520.32
8.2.100.0130.00718.55
8.2.90.0080.01019.04
8.2.80.0080.00318.35
8.2.70.0110.00418.30
8.2.60.0060.00718.20
8.2.50.0100.00318.48
8.2.40.0090.00219.33
8.2.30.0080.00418.51
8.2.20.0100.00018.18
8.2.10.0050.00618.63
8.2.00.0110.00018.52
8.1.280.0110.00425.92
8.1.270.0060.00623.99
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0080.00318.83
8.1.230.0100.00318.90
8.1.220.0060.00518.18
8.1.210.0090.00119.27
8.1.200.0070.00517.97
8.1.190.0130.00517.95
8.1.180.0110.00818.64
8.1.170.0070.00818.57
8.1.160.0080.00320.52
8.1.150.0050.00519.65
8.1.140.0110.00317.96
8.1.130.0080.00318.21
8.1.120.0070.00418.05
8.1.110.0060.00518.03
8.1.100.0090.00318.00
8.1.90.0040.00618.04
8.1.80.0060.00417.95
8.1.70.0040.00518.12
8.1.60.0050.00718.17
8.1.50.0100.00218.05
8.1.40.0020.00818.14
8.1.30.0050.00518.23
8.1.20.0080.00418.22
8.1.10.0090.00118.19
8.1.00.0060.00418.16
8.0.300.0050.00619.39
8.0.290.0060.00517.56
8.0.280.0080.00218.24
8.0.270.0080.00317.66
8.0.260.0060.00417.51
8.0.250.0080.00317.51
8.0.240.0070.00317.56
8.0.230.0100.00017.65
8.0.220.0070.00417.51
8.0.210.0070.00317.54
8.0.200.0090.00217.57
8.0.190.0070.00417.63
8.0.180.0080.00517.36
8.0.170.0030.00717.39
8.0.160.0100.00217.58
8.0.150.0110.00117.47
8.0.140.0100.00217.43
8.0.130.0070.00315.93
8.0.120.0080.00417.56
8.0.110.0060.00517.52
8.0.100.0050.00617.38
8.0.90.0080.00317.38
8.0.80.0100.00817.50
8.0.70.0070.00417.55
8.0.60.0080.00417.42
8.0.50.0110.00017.30
8.0.30.0150.00617.46
8.0.20.0170.00517.67
8.0.10.0100.00217.47
8.0.00.0090.00518.62
7.4.330.0050.00315.66
7.4.320.0000.00817.21
7.4.300.0040.00317.16
7.4.290.0080.00017.88
7.4.280.0070.00317.14
7.4.270.0060.00217.05
7.4.260.0040.00317.20
7.4.250.0010.00617.03
7.4.240.0030.00516.92
7.4.230.0070.00317.09
7.4.220.0050.00717.11
7.4.210.0070.00516.91
7.4.200.0030.00317.10
7.4.190.0070.00217.07
7.4.180.0040.00417.63
7.4.160.0060.00517.25
7.4.150.0120.00017.48
7.4.140.0100.00517.79
7.4.130.0090.00616.83
7.4.120.0090.00616.98
7.4.110.0160.00317.00
7.4.100.0140.00617.06
7.4.90.0090.00817.12
7.4.80.0140.00418.50
7.4.70.0180.00216.86
7.4.60.0090.00816.91
7.4.50.0100.00516.83
7.4.40.0110.00520.15
7.4.30.0090.00716.93
7.4.20.0160.00017.40
7.4.10.0080.00817.55
7.4.00.0040.00916.31
7.3.330.0020.00415.37
7.3.320.0050.00615.29
7.3.310.0070.00516.98
7.3.300.0060.00617.02
7.3.290.0130.00316.93
7.3.280.0100.00916.69
7.3.270.0110.00617.42
7.3.260.0140.00716.96
7.3.250.0120.00516.74
7.3.240.0190.00617.01
7.3.230.0080.01416.95
7.3.220.0310.00817.25
7.3.210.0230.00516.73
7.3.200.0190.00518.40
7.3.190.0140.00616.90
7.3.180.0140.00616.85
7.3.170.0140.00416.97
7.3.160.0100.00616.94
7.3.150.0120.00617.05
7.3.140.0150.00617.41
7.3.130.0110.01117.18
7.3.120.0100.00216.13
7.3.110.0120.00417.24
7.3.100.0040.01217.12
7.3.90.0130.00317.55
7.3.80.0120.00417.53
7.3.70.0120.00317.53
7.3.60.0100.00517.65
7.3.50.0060.00917.54
7.3.40.0080.00817.44
7.3.30.0130.00217.68
7.3.20.0100.00719.18
7.3.10.0120.00419.24
7.3.00.0090.00019.31
7.2.340.0000.00817.24
7.2.330.0120.00417.04
7.2.320.0090.00717.01
7.2.310.0070.01016.97
7.2.300.0130.00517.16
7.2.290.0140.00817.03
7.2.280.0230.00517.59
7.2.270.0180.00317.54
7.2.260.0100.00517.50
7.2.250.0120.00417.66
7.2.240.0120.00317.23
7.2.230.0080.00817.49
7.2.220.0130.00317.55
7.2.210.0160.00017.46
7.2.200.0170.00017.70
7.2.190.0100.00617.57
7.2.180.0130.00317.55
7.2.170.0120.00317.68
7.2.160.0170.00417.60
7.2.150.0240.00719.03
7.2.140.0190.00319.11
7.2.130.0160.00719.25
7.2.120.0090.00919.41
7.2.110.0100.00719.15
7.2.100.0140.00319.66
7.2.90.0150.00219.38
7.2.80.0130.00419.55
7.2.70.0180.00019.57
7.2.60.0120.00518.29
7.2.50.0170.00019.52
7.2.40.0130.00319.33
7.2.30.0120.00519.54
7.2.20.0100.00719.48
7.2.10.0080.00820.65
7.2.00.0070.00419.57
7.1.330.0040.00418.31
7.1.320.0090.00518.07
7.1.310.0120.00318.43
7.1.300.0150.00018.28
7.1.290.0110.00418.27
7.1.280.0040.01118.10
7.1.270.0090.00618.27
7.1.260.0120.00218.30
7.1.250.0100.00518.26
7.1.240.0110.00418.45
7.1.230.0150.01118.25
7.1.220.0270.00018.37
7.1.210.0140.00718.21
7.1.200.0120.00516.88
7.1.190.0080.00818.50
7.1.180.0100.00718.23
7.1.170.0130.00019.47
7.1.160.0120.00418.30
7.1.150.0170.00817.96
7.1.140.0160.00318.20
7.1.130.0130.00618.15
7.1.120.0080.00818.32
7.1.110.0090.00618.47
7.1.100.0090.00218.15
7.1.90.0150.00018.16
7.1.80.0120.00318.37
7.1.70.0090.00517.61
7.1.60.0130.00618.89
7.1.50.0090.01117.71
7.1.40.0200.00018.24
7.1.30.0170.00018.19
7.1.20.0150.00418.18
7.1.10.0110.00418.22
7.1.00.0100.04020.17
7.0.330.0250.00417.96
7.0.320.0300.00017.78
7.0.310.0100.00717.70
7.0.300.0180.00017.76
7.0.290.0160.00018.15
7.0.280.0080.00817.78
7.0.270.0060.00818.07
7.0.260.0150.00017.79
7.0.250.0150.00018.16
7.0.240.0130.00318.05
7.0.230.0150.00018.10
7.0.220.0090.00518.02
7.0.210.0110.00418.16
7.0.200.0080.00417.54
7.0.190.0150.00017.80
7.0.180.0090.00618.02
7.0.170.0150.00018.24
7.0.160.0150.00018.14
7.0.150.0150.00017.89
7.0.140.0060.04020.03
7.0.130.0150.00017.95
7.0.120.0110.00517.85
7.0.110.0110.00617.76
7.0.100.0060.03019.00
7.0.90.0150.03718.87
7.0.80.0100.03918.88
7.0.70.0070.04218.75
7.0.60.0110.03819.05
7.0.50.0100.03819.10
7.0.40.0090.02519.12
7.0.30.0160.03719.18
7.0.20.0090.05119.04
7.0.10.0170.02019.12
7.0.00.0170.04019.11
5.6.400.0150.00417.00
5.6.390.0110.01516.80
5.6.380.0240.00316.87
5.6.370.0210.00617.00
5.6.360.0320.00016.94
5.6.350.0050.01016.90
5.6.340.0110.00017.04
5.6.330.0040.00416.82
5.6.320.0170.00017.00
5.6.310.0060.00317.05
5.6.300.0050.00316.72
5.6.290.0040.00417.01
5.6.280.0110.03718.92
5.6.270.0130.01317.14
5.6.260.0070.00716.97
5.6.250.0040.04518.84
5.6.240.0050.04518.65
5.6.230.0080.04118.92
5.6.220.0050.04718.95
5.6.210.0150.03718.88
5.6.200.0070.04218.93
5.6.190.0070.03719.13
5.6.180.0040.04319.16
5.6.170.0050.04719.11
5.6.160.0110.03719.14
5.6.150.0060.02519.14
5.6.140.0070.03019.07
5.6.130.0150.02819.09
5.6.120.0100.02519.00
5.6.110.0100.04019.13
5.6.100.0130.03819.06
5.6.90.0060.02819.00
5.6.80.0100.03618.73
5.6.70.0090.03418.73
5.6.60.0050.04618.74
5.6.50.0100.02218.67
5.6.40.0030.02618.63
5.6.30.0050.02818.64
5.6.20.0120.02818.79
5.6.10.0030.04518.66
5.6.00.0090.03818.55
5.5.380.0110.04118.61
5.5.370.0170.03318.74
5.5.360.0130.03818.66
5.5.350.0090.04518.60
5.5.340.0120.04018.85
5.5.330.0090.02518.80
5.5.320.0120.03818.88
5.5.310.0070.04318.88
5.5.300.0090.02218.91
5.5.290.0090.03318.85
5.5.280.0100.02318.87
5.5.270.0080.04018.82
5.5.260.0170.03318.76
5.5.250.0070.03818.80
5.5.240.0120.03818.61
5.5.230.0150.03218.57
5.5.220.0120.04018.67
5.5.210.0060.04418.75
5.5.200.0150.03718.29
5.5.190.0070.04718.54
5.5.180.0120.04218.34
5.5.170.0160.00617.02
5.5.160.0070.04218.46
5.5.150.0060.03618.50
5.5.140.0120.03518.38
5.5.130.0130.03418.45
5.5.120.0060.04418.39
5.5.110.0080.03818.48
5.5.100.0110.04318.61
5.5.90.0050.03718.53
5.5.80.0120.03818.66
5.5.70.0050.02818.61
5.5.60.0040.03318.60
5.5.50.0070.03818.61
5.5.40.0080.03018.56
5.5.30.0020.02918.92
5.5.20.0070.04018.44
5.5.10.0040.04318.47
5.5.00.0050.04418.43
5.4.450.0060.04017.74
5.4.440.0070.04117.89
5.4.430.0010.04517.86
5.4.420.0080.03717.72
5.4.410.0000.04417.74
5.4.400.0030.03317.57
5.4.390.0090.03517.55
5.4.380.0020.04417.58
5.4.370.0080.03717.64
5.4.360.0020.03917.74
5.4.350.0030.04217.55
5.4.340.0030.04017.54
5.4.330.0030.00316.25
5.4.320.0070.02417.71
5.4.310.0010.04017.64
5.4.300.0020.04317.70
5.4.290.0020.04217.71
5.4.280.0060.03617.60
5.4.270.0030.03517.74
5.4.260.0060.03817.64
5.4.250.0100.03717.71
5.4.240.0020.04317.68
5.4.230.0070.04217.57
5.4.220.0060.03817.65
5.4.210.0070.03317.75
5.4.200.0140.03717.71
5.4.190.0050.02817.65
5.4.180.0100.03417.68
5.4.170.0100.03717.69
5.4.160.0050.03917.66
5.4.150.0110.03317.73
5.4.140.0030.02216.33
5.4.130.0100.03116.36
5.4.120.0050.02516.38
5.4.110.0000.04516.34
5.4.100.0080.02816.32
5.4.90.0050.03816.39
5.4.80.0060.02316.40
5.4.70.0060.03716.30
5.4.60.0030.03216.35
5.4.50.0080.03816.28
5.4.40.0100.03316.37
5.4.30.0090.02016.34
5.4.20.0070.03716.28
5.4.10.0070.02816.35
5.4.00.0080.03416.06
5.3.290.0120.03515.49
5.3.280.0090.03515.46
5.3.270.0070.03915.40
5.3.260.0050.03315.47
5.3.250.0080.03415.41
5.3.240.0050.03515.49
5.3.230.0050.03615.44
5.3.220.0040.04015.47
5.3.210.0000.04315.40
5.3.200.0110.03415.45
5.3.190.0080.03315.41
5.3.180.0060.03715.40
5.3.170.0070.03915.42
5.3.160.0120.02615.39
5.3.150.0080.03715.46
5.3.140.0060.03815.47
5.3.130.0050.03515.38
5.3.120.0080.03515.37
5.3.110.0060.03515.38
5.3.100.0050.03815.21
5.3.90.0030.04315.13
5.3.80.0060.03815.21
5.3.70.0080.03815.14
5.3.60.0050.03815.16
5.3.50.0050.04015.10
5.3.40.0040.03715.13
5.3.30.0030.03315.10
5.3.20.0060.03715.01
5.3.10.0030.03314.95
5.3.00.0040.03115.01

preferences:
45.88 ms | 401 KiB | 5 Q