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.b1.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.70.0090.00918.43
8.3.60.0150.00616.49
8.3.50.0180.00322.11
8.3.40.0110.00418.97
8.3.30.0000.01418.79
8.3.20.0080.00020.39
8.3.10.0030.00523.66
8.3.00.0080.00019.50
8.2.190.0100.01018.41
8.2.180.0140.00717.00
8.2.170.0100.01022.96
8.2.160.0100.01020.25
8.2.150.0050.00324.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0110.00017.75
8.2.110.0030.00621.00
8.2.100.0080.00317.91
8.2.90.0000.00817.88
8.2.80.0040.00417.97
8.2.70.0060.00317.93
8.2.60.0000.00817.78
8.2.50.0000.00918.10
8.2.40.0040.00420.33
8.2.30.0000.00720.59
8.2.20.0050.00317.72
8.2.10.0040.00418.07
8.2.00.0070.00018.18
8.1.280.0040.01125.92
8.1.270.0080.00023.82
8.1.260.0040.00426.35
8.1.250.0060.00328.09
8.1.240.0000.00922.20
8.1.230.0040.00819.14
8.1.220.0000.00817.78
8.1.210.0040.00418.77
8.1.200.0030.00617.22
8.1.190.0000.00817.23
8.1.180.0000.00818.10
8.1.170.0030.00618.51
8.1.160.0070.00022.05
8.1.150.0070.00018.81
8.1.140.0000.00819.57
8.1.130.0000.00717.63
8.1.120.0000.00717.50
8.1.110.0000.00817.40
8.1.100.0040.00417.45
8.1.90.0000.00717.45
8.1.80.0080.00017.49
8.1.70.0030.00317.38
8.1.60.0060.00317.63
8.1.50.0000.00817.52
8.1.40.0000.00817.53
8.1.30.0030.00617.62
8.1.20.0000.00717.59
8.1.10.0040.00417.62
8.1.00.0040.00417.46
8.0.300.0070.00021.96
8.0.290.0050.00216.75
8.0.280.0030.00618.37
8.0.270.0000.00717.22
8.0.260.0040.00417.31
8.0.250.0000.00717.02
8.0.240.0040.00417.05
8.0.230.0000.00916.91
8.0.220.0030.00316.96
8.0.210.0070.00016.89
8.0.200.0040.00416.98
8.0.190.0000.00816.98
8.0.180.0070.00016.98
8.0.170.0040.00416.88
8.0.160.0040.00416.93
8.0.150.0030.00316.91
8.0.140.0040.00416.98
8.0.130.0030.00313.35
8.0.120.0040.00416.93
8.0.110.0000.00716.98
8.0.100.0040.00416.95
8.0.90.0000.00816.85
8.0.80.0090.00617.00
8.0.70.0050.00316.83
8.0.60.0040.00416.91
8.0.50.0030.00517.00
8.0.30.0130.01017.17
8.0.20.0150.00717.40
8.0.10.0070.00017.07
8.0.00.0100.00916.69
7.4.330.0000.00515.20
7.4.320.0060.00016.50
7.4.300.0000.00616.61
7.4.290.0070.00016.46
7.4.280.0040.00416.53
7.4.270.0000.00816.60
7.4.260.0000.00816.59
7.4.250.0030.00516.38
7.4.240.0040.00416.56
7.4.230.0000.00716.42
7.4.220.0060.01216.41
7.4.210.0070.01416.47
7.4.200.0030.00316.31
7.4.160.0040.01416.38
7.4.150.0150.00317.40
7.4.140.0110.01017.86
7.4.130.0060.01316.56
7.4.120.0150.00316.58
7.4.110.0080.01416.64
7.4.100.0060.01216.32
7.4.90.0090.01516.75
7.4.80.0090.00919.39
7.4.70.0140.00416.42
7.4.60.0130.00316.49
7.4.50.0040.00416.42
7.4.40.0090.01216.46
7.4.30.0110.01116.38
7.4.10.0090.00314.88
7.4.00.0070.01115.09
7.3.330.0030.00313.35
7.3.320.0000.00513.45
7.3.310.0040.00416.48
7.3.300.0070.00016.44
7.3.290.0110.00816.40
7.3.280.0110.00716.49
7.3.270.0040.01317.40
7.3.260.0130.00516.41
7.3.250.0090.00816.37
7.3.240.0120.00616.57
7.3.230.0070.01016.66
7.3.210.0080.00816.32
7.3.200.0130.00316.41
7.3.190.0090.00616.32
7.3.180.0070.01116.29
7.3.170.0120.00616.45
7.3.160.0060.01016.44
7.3.130.0070.01114.64
7.3.120.0090.00714.90
7.3.110.0060.01014.76
7.3.100.0060.00314.87
7.3.90.0050.00914.90
7.3.80.0110.00514.96
7.3.70.0080.00514.79
7.3.60.0060.00614.85
7.3.50.0040.00714.92
7.3.40.0060.00914.85
7.3.30.0070.00514.78
7.3.20.0080.00816.62
7.3.10.0070.00516.66
7.3.00.0050.01016.72
7.2.330.0100.00916.64
7.2.320.0090.00816.66
7.2.310.0060.01116.81
7.2.300.0090.00916.51
7.2.290.0100.00716.78
7.2.260.0110.00614.86
7.2.250.0110.00714.94
7.2.240.0030.00915.06
7.2.230.0070.00714.92
7.2.220.0030.00714.97
7.2.210.0080.00615.04
7.2.200.0050.01015.29
7.2.190.0040.01015.11
7.2.180.0050.00915.00
7.2.170.0040.01215.12
7.2.160.0030.00815.23
7.2.150.0080.00616.92
7.2.140.0050.00917.14
7.2.130.0090.00617.11
7.2.120.0060.00517.01
7.2.110.0060.00816.94
7.2.100.0050.01116.94
7.2.90.0030.01016.87
7.2.80.0090.00716.99
7.2.70.0090.00616.87
7.2.60.0080.00616.81
7.2.50.0050.01116.84
7.2.40.0040.00916.90
7.2.30.0070.00916.84
7.2.20.0050.01016.79
7.2.10.0070.00616.93
7.2.00.0050.01017.72
7.1.330.0030.01015.87
7.1.320.0030.00815.94
7.1.310.0110.00215.79
7.1.300.0070.00415.70
7.1.290.0060.01115.69
7.1.280.0060.00915.92
7.1.270.0070.00715.82
7.1.260.0050.00815.94
7.1.250.0060.00615.96
7.1.240.0050.00516.02
7.1.230.0120.00415.85
7.1.220.0060.00915.56
7.1.210.0030.01015.83
7.1.200.0040.00915.83
7.1.190.0000.01015.87
7.1.180.0070.01115.77
7.1.170.0090.00615.83
7.1.160.0000.01115.75
7.1.150.0030.00615.77
7.1.140.0060.01015.66
7.1.130.0080.00615.77
7.1.120.0070.01015.77
7.1.110.0030.01015.71
7.1.100.0020.01117.02
7.1.90.0030.00615.51
7.1.80.0100.00615.94
7.1.70.0060.00616.57
7.1.60.0070.01017.64
7.1.50.0050.01116.54
7.1.40.0040.00715.69
7.1.30.0100.00315.61
7.1.20.0090.00315.55
7.1.10.0090.00615.82
7.1.00.0060.03718.94
7.0.330.0070.00715.34
7.0.320.0090.00915.43
7.0.310.0060.00615.40
7.0.300.0060.00615.53
7.0.290.0080.00415.44
7.0.280.0040.00815.54
7.0.270.0070.00315.52
7.0.260.0040.00815.37
7.0.250.0030.00715.35
7.0.240.0000.01315.69
7.0.230.0080.00015.55
7.0.220.0040.00715.49
7.0.210.0070.00715.34
7.0.200.0080.00515.19
7.0.190.0040.01115.43
7.0.180.0060.00615.16
7.0.170.0070.00715.25
7.0.160.0040.00715.49
7.0.150.0060.00315.45
7.0.140.0070.00715.51
7.0.130.0030.00615.58
7.0.120.0000.00815.47
7.0.110.0030.00615.51
7.0.100.0070.00715.37
7.0.90.0080.00415.27
7.0.80.0000.01515.12
7.0.70.0070.00715.59
7.0.60.0070.04317.71
7.0.50.0020.02516.82
7.0.40.0100.02316.79
7.0.30.0230.03116.79
7.0.20.0200.03316.84
7.0.10.0050.03216.84
7.0.00.0050.04816.73
5.6.400.0110.00014.37
5.6.390.0030.00714.17
5.6.380.0120.00013.83
5.6.370.0030.00814.09
5.6.360.0060.00614.14
5.6.350.0070.00713.80
5.6.340.0090.00314.13
5.6.330.0000.01614.28
5.6.320.0080.00314.11
5.6.310.0040.00814.19
5.6.300.0130.00314.20
5.6.290.0030.00914.11
5.6.280.0050.04017.56
5.6.270.0030.00914.07
5.6.260.0080.00314.26
5.6.250.0040.00713.93
5.6.240.0120.00314.11
5.6.230.0030.00714.14
5.6.220.0100.00614.05
5.6.210.0020.05017.28
5.6.200.0050.04216.11
5.6.190.0080.04417.38
5.6.180.0170.04117.43
5.6.170.0150.02517.44
5.6.160.0080.02817.37
5.6.150.0090.02316.20
5.6.140.0040.04616.04
5.6.130.0050.03116.30
5.6.120.0070.03017.53
5.6.110.0030.04717.52
5.6.100.0100.03817.62
5.6.90.0110.03817.62
5.6.80.0030.03817.17
5.6.70.0070.00314.29
5.6.60.0060.01014.20
5.6.50.0030.01013.99
5.6.40.0100.00314.07
5.6.30.0000.01013.90
5.6.20.0060.00614.09
5.6.10.0060.00614.12
5.6.00.0040.01114.19
5.5.380.0090.00614.27
5.5.370.0040.00813.92
5.5.360.0130.00314.09
5.5.350.0200.04017.12
5.5.340.0050.02515.95
5.5.330.0030.04717.09
5.5.320.0080.03117.18
5.5.310.0180.04017.09
5.5.300.0070.04416.10
5.5.290.0030.04516.15
5.5.280.0060.03217.38
5.5.270.0080.03017.19
5.5.260.0000.03417.48
5.5.250.0100.04317.21
5.5.240.0020.03016.99
5.5.230.0090.00614.13
5.5.220.0040.01113.84
5.5.210.0080.00014.09
5.5.200.0100.00313.72
5.5.190.0110.00414.15
5.5.180.0120.00313.87
5.5.170.0070.00314.05
5.5.160.0080.00614.04
5.5.150.0080.00814.07
5.5.140.0080.00314.06
5.5.130.0000.01513.84
5.5.120.0070.00714.00
5.5.110.0090.00613.83
5.5.100.0060.01014.12
5.5.90.0090.00614.32
5.5.80.0030.00713.77
5.5.70.0040.01113.84
5.5.60.0060.00614.09
5.5.50.0060.00913.93
5.5.40.0060.00314.14
5.5.30.0060.00914.11
5.5.20.0070.00313.97
5.5.10.0000.01013.73
5.5.00.0070.00713.84
5.4.450.0100.03115.26
5.4.440.0130.02715.05
5.4.430.0070.03514.98
5.4.420.0110.02815.29
5.4.410.0150.02515.05
5.4.400.0060.03314.91
5.4.390.0030.03514.93
5.4.380.0050.03514.93
5.4.370.0130.02715.21
5.4.360.0180.03514.70
5.4.350.0130.02614.95
5.4.340.0070.03514.92
5.4.330.0000.00610.57
5.4.320.0110.03015.10
5.4.310.0150.02315.01
5.4.300.0100.03014.93
5.4.290.0080.03215.03
5.4.280.0180.02114.83
5.4.270.0100.03014.92
5.4.260.0100.02815.12
5.4.250.0120.02914.98
5.4.240.0130.02815.07
5.4.230.0080.03514.97
5.4.220.0140.02914.91
5.4.210.0110.02515.01
5.4.200.0120.02614.97
5.4.190.0130.02915.00
5.4.180.0080.03214.97
5.4.170.0090.03415.11
5.4.160.0100.02714.96
5.4.150.0050.03815.02
5.4.140.0090.02913.65
5.4.130.0120.02613.54
5.4.120.0100.02813.50
5.4.110.0080.03313.52
5.4.100.0120.03013.67
5.4.90.0030.04113.61
5.4.80.0130.02613.64
5.4.70.0110.02513.60
5.4.60.0080.04113.58
5.4.50.0050.03713.55
5.4.40.0170.02613.63
5.4.30.0130.02713.39
5.4.20.0190.03013.48
5.4.10.0070.03013.70
5.4.00.0080.02813.44

preferences:
55.14 ms | 401 KiB | 5 Q