3v4l.org

run code in 300+ PHP versions simultaneously
<?php function delete(array &$array, string $key): bool { // process the parts $target =& $array; // split the key in it's parts $key_parts = explode('.', $key); while (true) { // check if this key exists, and bail out if it doesn't if ( ! array_key_exists($key_parts[0], $target)) { return false; } // last key component? if (count($key_parts) === 1) { // delete the target found unset($target[$key_parts[0]]); return true; } // change the target $target =& $target[$key_parts[0]]; // and on to the next key part array_shift($key_parts); } } $arr = array('a' => array('b1' => array('c1' => 'value c1', 'c2' => 'value c2'), 'b2' => 'value b2')); var_dump(delete($arr, 'a.b.c1'), $arr);

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.0140.00716.63
8.3.50.0070.01422.05
8.3.40.0090.00618.84
8.3.30.0120.00618.79
8.3.20.0040.00420.31
8.3.10.0040.00423.71
8.3.00.0060.00319.38
8.2.180.0070.01016.63
8.2.170.0100.01022.96
8.2.160.0120.00820.52
8.2.150.0150.00424.18
8.2.140.0110.00424.66
8.2.130.0060.00326.16
8.2.120.0030.00917.73
8.2.110.0060.00320.92
8.2.100.0060.00618.03
8.2.90.0050.00317.88
8.2.80.0040.00817.97
8.2.70.0060.00317.93
8.2.60.0040.00418.05
8.2.50.0000.00818.10
8.2.40.0060.00320.59
8.2.30.0070.00020.51
8.2.20.0040.00417.87
8.2.10.0050.00218.18
8.2.00.0070.00018.23
8.1.280.0140.00025.92
8.1.270.0040.00423.88
8.1.260.0050.00326.35
8.1.250.0040.01128.09
8.1.240.0050.00523.98
8.1.230.0080.00319.16
8.1.220.0000.00817.77
8.1.210.0000.00818.77
8.1.200.0060.00317.35
8.1.190.0000.00817.00
8.1.180.0040.00418.10
8.1.170.0080.00018.48
8.1.160.0000.00722.01
8.1.150.0000.00818.80
8.1.140.0000.00819.58
8.1.130.0030.00317.70
8.1.120.0040.00417.48
8.1.110.0040.00417.34
8.1.100.0000.00717.41
8.1.90.0030.00317.51
8.1.80.0040.00417.37
8.1.70.0040.00417.51
8.1.60.0060.00317.64
8.1.50.0080.00017.41
8.1.40.0060.00317.41
8.1.30.0000.00917.72
8.1.20.0040.00417.68
8.1.10.0000.00717.48
8.1.00.0050.00317.57
8.0.300.0040.00421.57
8.0.290.0000.00716.75
8.0.280.0030.00318.34
8.0.270.0070.00017.18
8.0.260.0000.00717.32
8.0.250.0040.00417.04
8.0.240.0040.00416.91
8.0.230.0000.01017.02
8.0.220.0000.00716.93
8.0.210.0000.00716.84
8.0.200.0030.00317.02
8.0.190.0030.00516.91
8.0.180.0000.00716.88
8.0.170.0000.00716.96
8.0.160.0070.00016.86
8.0.150.0000.00716.80
8.0.140.0030.00316.86
8.0.130.0050.00013.31
8.0.120.0080.00016.93
8.0.110.0000.00817.00
8.0.100.0000.00816.89
8.0.90.0000.00816.84
8.0.80.0120.00316.98
8.0.70.0040.00416.82
8.0.60.0040.00416.86
8.0.50.0070.00016.99
8.0.30.0110.00717.19
8.0.20.0100.00917.40
8.0.10.0000.00717.07
8.0.00.0080.01016.74
7.4.330.0050.00015.09
7.4.320.0040.00416.52
7.4.300.0000.00616.40
7.4.290.0000.00716.62
7.4.280.0070.00016.50
7.4.270.0040.00416.61
7.4.260.0000.00716.53
7.4.250.0040.00416.55
7.4.240.0060.00216.58
7.4.230.0030.00316.46
7.4.220.0100.01316.63
7.4.210.0030.01116.69
7.4.200.0070.00016.71
7.4.160.0000.01616.32
7.4.150.0090.00917.40
7.4.140.0090.01217.86
7.4.130.0070.01016.51
7.4.120.0110.00616.45
7.4.110.0080.01716.47
7.4.100.0120.01216.56
7.4.90.0130.00416.68
7.4.80.0060.01219.39
7.4.70.0130.00316.67
7.4.60.0070.01116.57
7.4.50.0040.00416.44
7.4.40.0070.01116.49
7.4.30.0080.00816.43
7.4.00.0070.01014.80
7.3.330.0000.00613.29
7.3.320.0050.00013.43
7.3.310.0030.00316.32
7.3.300.0060.00316.24
7.3.290.0060.01216.45
7.3.280.0050.01016.41
7.3.270.0120.00617.40
7.3.260.0050.01116.41
7.3.240.0110.00616.51
7.3.230.0080.00916.44
7.3.210.0040.01216.34
7.3.200.0040.01616.36
7.3.190.0100.00716.60
7.3.180.0100.01016.63
7.3.170.0130.01016.36
7.3.160.0110.00516.46
7.3.00.0160.00016.48
7.2.330.0130.00416.48
7.2.320.0110.00716.92
7.2.310.0040.01216.55
7.2.300.0060.01616.70
7.2.290.0130.01016.90
7.2.130.0140.00817.07
7.2.120.0190.00616.67
7.2.110.0090.00616.79
7.2.100.0050.00816.47
7.2.90.0030.00816.70
7.2.80.0090.00316.79
7.2.70.0100.00316.79
7.2.60.0090.00916.79
7.2.50.0030.00916.63
7.2.40.0100.00716.90
7.2.30.0040.01017.09
7.2.20.0090.00616.70
7.2.10.0110.00416.60
7.2.00.0050.01118.18
7.1.250.0120.00615.89
7.1.240.0110.00415.73
7.1.230.0030.01015.75
7.1.220.0040.00715.70
7.1.210.0100.00315.57
7.1.200.0060.00615.78
7.1.190.0060.00615.78
7.1.180.0090.00315.59
7.1.170.0070.00715.78
7.1.160.0030.00615.98
7.1.150.0000.00815.96
7.1.140.0070.00715.89
7.1.130.0070.00715.83
7.1.120.0120.00315.92
7.1.110.0060.00615.89
7.1.100.0050.00816.93
7.1.90.0070.00515.63
7.1.80.0060.00615.63
7.1.70.0030.00816.52
7.1.60.0050.01517.51
7.1.50.0030.00716.43
7.1.40.0060.00915.57
7.1.30.0070.00715.72
7.1.20.0100.00715.67
7.1.10.0030.00715.97
7.1.00.0050.04119.09
7.0.330.0080.00415.35
7.0.320.0070.00415.18
7.0.310.0090.00614.99
7.0.300.0090.00015.07
7.0.290.0070.00715.05
7.0.280.0040.00415.27
7.0.270.0000.01415.47
7.0.260.0100.00615.09
7.0.250.0050.00515.28
7.0.240.0040.00815.41
7.0.230.0090.00615.27
7.0.220.0090.00615.45
7.0.210.0080.00415.26
7.0.200.0050.00615.19
7.0.190.0070.01015.21
7.0.180.0040.00915.35
7.0.170.0080.00415.52
7.0.160.0000.01215.25
7.0.150.0090.00315.59
7.0.140.0040.00415.14
7.0.130.0090.00615.16
7.0.120.0030.00915.39
7.0.110.0080.00415.09
7.0.100.0080.00415.34
7.0.90.0030.00715.13
7.0.80.0030.00914.94
7.0.70.0030.01315.28
7.0.60.0150.04017.65
7.0.50.0060.04516.66
7.0.40.0030.05016.71
7.0.30.0220.02516.77
7.0.20.0190.04016.82
7.0.10.0060.04616.65
7.0.00.0070.04116.82
5.6.380.0060.00613.77
5.6.370.0030.01014.24
5.6.360.0030.00913.97
5.6.350.0040.00713.93
5.6.340.0030.00914.12
5.6.330.0040.01114.39
5.6.320.0000.00914.06
5.6.310.0030.01313.88
5.6.300.0040.00413.83
5.6.290.0080.00514.29
5.6.280.0040.03017.54
5.6.270.0100.00313.94
5.6.260.0060.00314.23
5.6.250.0090.00614.25
5.6.240.0000.00813.95
5.6.230.0070.00413.94
5.6.220.0030.00914.12
5.6.210.0120.03717.34
5.6.200.0070.04516.04
5.6.190.0040.03717.08
5.6.180.0220.03517.28
5.6.170.0130.02617.28
5.6.160.0050.04517.25
5.6.150.0000.03116.15
5.6.140.0100.03716.11
5.6.130.0050.03616.10
5.6.120.0070.04217.58
5.6.110.0080.04017.33
5.6.100.0100.02017.41
5.6.90.0080.02517.60
5.6.80.0070.03817.15
5.6.70.0030.00613.93
5.6.60.0080.00513.88
5.6.50.0070.01013.86
5.6.40.0070.00713.75
5.6.30.0070.00713.75
5.6.20.0120.00314.04
5.6.10.0040.01213.96
5.6.00.0060.00914.05
5.5.380.0090.00010.68
5.5.370.0040.00810.83
5.5.360.0050.00510.89
5.5.350.0180.04115.54
5.5.340.0050.03714.28
5.5.330.0080.04615.64
5.5.320.0140.02015.53
5.5.310.0170.03915.54
5.5.300.0070.03314.45
5.5.290.0040.04614.49
5.5.280.0060.02315.85
5.5.270.0170.03615.70
5.5.260.0060.02315.82
5.5.250.0030.02615.68
5.5.240.0070.01915.54
5.5.230.0060.00310.71
5.5.220.0060.00610.80
5.5.210.0050.00510.52
5.5.200.0000.01010.61
5.5.190.0030.00610.63
5.5.180.0050.00510.39
5.5.170.0080.00310.58
5.5.160.0020.01010.55
5.5.150.0060.00610.68
5.5.140.0000.01010.84
5.5.130.0000.00710.27
5.5.120.0090.00310.82
5.5.110.0000.01010.90
5.5.100.0000.01110.83
5.5.90.0050.00210.64
5.5.80.0000.00510.62
5.5.70.0030.00310.54
5.5.60.0000.00910.85
5.5.50.0030.00310.86
5.5.40.0040.00410.43
5.5.30.0000.00810.53
5.5.20.0060.00610.87
5.5.10.0000.00810.71
5.5.00.0040.00410.65
5.4.450.0350.02815.22
5.4.440.0330.02915.29
5.4.430.0450.02315.12
5.4.420.0330.03315.16
5.4.410.0280.03315.02
5.4.400.0410.03214.93
5.4.390.0340.02715.01
5.4.380.0350.03114.93
5.4.370.0320.03015.05
5.4.360.0330.03414.94
5.4.350.0490.02615.11
5.4.340.0080.03514.95
5.4.330.0040.00410.48
5.4.320.0050.03114.88
5.4.310.0090.02614.78
5.4.300.0260.02514.97
5.4.290.0420.03314.82
5.4.280.0470.03314.93
5.4.270.0430.03014.99
5.4.260.0510.03214.72
5.4.250.0350.03014.96
5.4.240.0380.02914.93
5.4.230.0400.03014.88
5.4.220.0420.03214.89
5.4.210.0470.03215.01
5.4.200.0400.03114.77
5.4.190.0450.02714.80
5.4.180.0370.03414.95
5.4.170.0380.02514.88
5.4.160.0350.02714.92
5.4.150.0380.03014.85
5.4.140.0370.03013.88
5.4.130.0250.03313.60
5.4.120.0350.02413.58
5.4.110.0350.03113.69
5.4.100.0300.03213.44
5.4.90.0400.02713.47
5.4.80.0350.02913.75
5.4.70.0320.02713.68
5.4.60.0380.02313.65
5.4.50.0250.03313.51
5.4.40.0400.02313.60
5.4.30.0250.03313.68
5.4.20.0280.02813.54
5.4.10.0300.02813.47
5.4.00.0320.02413.31

preferences:
70.03 ms | 401 KiB | 5 Q