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 ( ! empty($key_parts)) { // check if this key exists, and bail out if it doesn't if ( ! array_key_exists($key_parts[0], $target)) { return false; } // change the target $target =& $target[$key_parts[0]]; // and on to the next key part array_shift($key_parts); } // delete the target found unset($target); return true; } $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.60.0070.01416.88
8.3.50.0110.01021.99
8.3.40.0070.00718.96
8.3.30.0120.00318.41
8.3.20.0150.00020.21
8.3.10.0110.00723.56
8.3.00.0050.00319.50
8.2.180.0140.00418.29
8.2.170.0110.00422.96
8.2.160.0070.00720.39
8.2.150.0110.00724.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0110.00017.50
8.2.110.0110.00019.27
8.2.100.0120.00317.91
8.2.90.0000.00819.30
8.2.80.0080.00017.97
8.2.70.0050.00317.75
8.2.60.0080.00018.04
8.2.50.0040.00418.07
8.2.40.0040.00419.28
8.2.30.0030.00520.52
8.2.20.0000.00817.70
8.2.10.0000.00718.12
8.2.00.0070.00018.17
8.1.280.0070.00725.92
8.1.270.0030.00623.66
8.1.260.0080.00026.35
8.1.250.0000.00728.09
8.1.240.0090.00023.92
8.1.230.0080.00420.73
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0030.00617.35
8.1.190.0050.00317.35
8.1.180.0050.00218.10
8.1.170.0040.00418.49
8.1.160.0000.00722.09
8.1.150.0030.00618.95
8.1.140.0050.00319.50
8.1.130.0040.00417.70
8.1.120.0040.00417.38
8.1.110.0040.00417.36
8.1.100.0040.00417.35
8.1.90.0050.00317.46
8.1.80.0040.00417.37
8.1.70.0030.00317.36
8.1.60.0040.00417.55
8.1.50.0000.00817.48
8.1.40.0030.00517.54
8.1.30.0000.00817.70
8.1.20.0030.00517.70
8.1.10.0030.00517.48
8.1.00.0000.00717.54
8.0.300.0040.00418.77
8.0.290.0040.00416.88
8.0.280.0000.00718.46
8.0.270.0030.00317.27
8.0.260.0030.00517.17
8.0.250.0000.00717.07
8.0.240.0030.00617.03
8.0.230.0030.00716.95
8.0.220.0040.00416.87
8.0.210.0030.00616.99
8.0.200.0000.00717.04
8.0.190.0060.00316.96
8.0.180.0000.00716.96
8.0.170.0040.00416.92
8.0.160.0040.00417.10
8.0.150.0000.00816.97
8.0.140.0000.00716.93
8.0.130.0060.00013.43
8.0.120.0030.00616.91
8.0.110.0000.00716.89
8.0.100.0000.00717.03
8.0.90.0070.00017.03
8.0.80.0060.01016.86
8.0.70.0000.00716.99
8.0.60.0040.00416.80
8.0.50.0050.00316.86
8.0.30.0060.01217.11
8.0.20.0130.00717.40
8.0.10.0030.00517.10
8.0.00.0120.00816.77
7.4.330.0050.00015.08
7.4.320.0020.00516.63
7.4.300.0000.00616.41
7.4.290.0030.00316.47
7.4.280.0050.00316.62
7.4.270.0000.00816.53
7.4.260.0000.00716.51
7.4.250.0040.00416.55
7.4.240.0040.00416.54
7.4.230.0040.00416.63
7.4.220.0190.00616.62
7.4.210.0150.00016.54
7.4.200.0050.00216.71
7.4.160.0150.00416.50
7.4.150.0110.00717.40
7.4.140.0120.00917.86
7.4.130.0160.00316.73
7.4.120.0070.01116.61
7.4.110.0090.01216.52
7.4.100.0070.01116.36
7.4.90.0050.01316.45
7.4.80.0110.01519.39
7.4.70.0090.00916.39
7.4.60.0070.01016.57
7.4.50.0000.00816.70
7.4.40.0160.00316.43
7.4.30.0090.00916.57
7.4.00.0080.00414.90
7.3.330.0000.00513.17
7.3.320.0000.00513.25
7.3.310.0020.00516.40
7.3.300.0030.00316.26
7.3.290.0070.00816.32
7.3.280.0070.00916.31
7.3.270.0110.00517.40
7.3.260.0100.01016.21
7.3.240.0110.00816.38
7.3.230.0090.01216.39
7.3.210.0100.00716.47
7.3.200.0100.00716.36
7.3.190.0060.01216.33
7.3.180.0040.01216.30
7.3.170.0060.01316.27
7.3.160.0110.00516.18
7.3.10.0060.00916.32
7.3.00.0040.00716.32
7.2.330.0110.00716.60
7.2.320.0120.00616.47
7.2.310.0040.01316.59
7.2.300.0100.00716.39
7.2.290.0060.01316.66
7.2.130.0080.00417.05
7.2.120.0030.01016.70
7.2.110.0030.01016.92
7.2.100.0090.00316.90
7.2.90.0000.01116.73
7.2.80.0000.00916.79
7.2.70.0030.00916.55
7.2.60.0030.01016.77
7.2.50.0060.00616.74
7.2.40.0000.01217.02
7.2.30.0000.01016.92
7.2.20.0080.00416.85
7.2.10.0030.00716.66
7.2.00.0000.01118.11
7.1.250.0000.00915.83
7.1.200.0000.01615.79
7.1.100.0000.01218.39
7.1.70.0030.00616.99
7.1.60.0070.01519.43
7.1.50.0100.01016.96
7.1.00.0070.07322.54
7.0.200.0040.00814.70
7.0.60.0130.07320.02
7.0.50.0100.07717.90
7.0.40.0200.07720.15
7.0.30.0630.04720.13
7.0.20.0300.07720.33
7.0.10.0000.05720.10
7.0.00.0070.05720.19
5.6.280.0030.05020.82
5.6.210.0030.08720.71
5.6.200.0030.07318.16
5.6.190.0100.08320.63
5.6.180.0230.06320.34
5.6.170.0300.07720.57
5.6.160.0100.04320.43
5.6.150.0130.07318.19
5.6.140.0070.04718.21
5.6.130.0000.09018.14
5.6.120.0070.08321.16
5.6.110.0130.08021.14
5.6.100.0230.07721.13
5.6.90.0100.06321.10
5.6.80.0100.03720.41
5.5.350.0300.05320.41
5.5.340.0070.05717.92
5.5.330.0100.08020.28
5.5.320.0270.03720.49
5.5.310.0230.08020.27
5.5.300.0170.07318.01
5.5.290.0000.04717.98
5.5.280.0170.07320.68
5.5.270.0070.08720.75
5.5.260.0100.04320.64
5.5.250.0030.06320.50
5.5.240.0100.08320.27
5.4.450.0100.08319.55
5.4.440.1230.05319.44
5.4.430.0230.04719.46
5.4.420.0070.08319.44
5.4.410.0200.05319.25
5.4.400.0200.05318.88
5.4.390.0230.07019.30
5.4.380.0070.06319.25
5.4.370.0200.05019.38
5.4.360.0270.04719.28
5.4.350.0200.05019.25
5.4.340.0200.06319.15
5.4.320.0200.05319.25
5.4.310.0130.05319.06
5.4.300.0170.05319.28
5.4.290.0200.05318.99
5.4.280.0230.05019.22
5.4.270.0270.05719.14
5.4.260.0230.05719.28
5.4.250.0200.04719.04
5.4.240.0330.04319.27
5.4.230.0100.07318.86
5.4.220.0300.04319.36
5.4.210.0170.05319.00
5.4.200.0100.06018.97
5.4.190.0270.06719.24
5.4.180.0230.05319.24
5.4.170.0270.05319.27
5.4.160.0230.04719.35
5.4.150.0130.05718.84
5.4.140.0100.06316.52
5.4.130.0130.05316.38
5.4.120.0300.04016.38
5.4.110.0170.06316.64
5.4.100.0170.05016.63
5.4.90.0200.04316.53
5.4.80.0200.05316.17
5.4.70.0200.06716.39
5.4.60.0230.05716.49
5.4.50.0200.04716.36
5.4.40.0130.05316.59
5.4.30.0300.03716.58
5.4.20.0230.04716.61
5.4.10.0200.05016.54
5.4.00.0230.04315.89

preferences:
54.95 ms | 401 KiB | 5 Q