3v4l.org

run code in 300+ PHP versions simultaneously
<?php function forget(&$array, $keys) { $original =& $array; foreach ((array) $keys as $key) { $parts = explode('.', $key); while (count($parts) > 1) { $part = array_shift($parts); if (isset($array[$part]) && is_array($array[$part])) { $array =& $array[$part]; } } unset($array[array_shift($parts)]); // clean up after each pass $array =& $original; } } print_r(forget(['a' => 0, 'b' => 'd']), ['b']);

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.0170.00318.52
8.3.50.0090.00921.92
8.3.40.0070.01018.83
8.3.30.0070.00718.90
8.3.20.0070.00020.34
8.3.10.0060.00323.66
8.3.00.0080.00018.96
8.2.180.0000.01518.54
8.2.170.0100.00722.96
8.2.160.0130.00322.18
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0000.00726.16
8.2.120.0050.00221.00
8.2.110.0110.01122.09
8.2.100.0060.00318.95
8.1.280.0070.01125.92
8.1.270.0060.00318.52
8.1.260.0000.00826.35
8.1.250.0070.00028.09
8.1.240.0000.01118.38
8.1.230.0180.00618.47
5.4.390.0200.04718.91
5.4.380.0130.06318.75
5.4.370.0170.05318.69
5.4.360.0130.06018.73
5.4.350.0300.04318.64
5.4.340.0230.05018.49
5.4.320.0230.05018.71
5.4.310.0200.05018.68
5.4.300.0300.05718.77
5.4.290.0130.05718.72
5.4.280.0270.04718.55
5.4.270.0270.04718.74
5.4.260.0270.05018.57
5.4.250.0430.05718.47
5.4.240.0200.05318.63
5.4.230.0200.05018.62
5.4.220.0170.05718.72
5.4.210.0200.05018.57
5.4.200.0200.05016.78
5.4.190.0170.05718.47
5.4.180.0370.04018.52
5.4.170.0200.05718.60
5.4.160.0270.07018.67
5.4.150.0200.05318.71
5.4.140.0270.04316.34
5.4.130.0130.05316.25
5.4.120.0170.05316.34
5.4.110.0300.04716.20
5.4.100.0200.05316.20
5.4.90.0170.05716.22
5.4.80.0270.04316.18
5.4.70.0170.05716.41
5.4.60.0270.04316.21
5.4.50.0130.05716.18
5.4.40.0300.04316.16
5.4.30.0230.04716.27
5.4.20.0200.05016.20
5.4.10.0200.05016.39
5.4.00.0270.04015.62
5.3.290.0230.05014.66
5.3.280.0330.03714.64
5.3.270.0300.04314.74
5.3.260.0270.04714.81
5.3.250.0170.05314.63
5.3.240.0270.04014.71
5.3.230.0200.05014.80
5.3.220.0170.06714.60
5.3.210.0230.05314.62
5.3.200.0130.05714.60
5.3.190.0270.05014.79
5.3.180.0230.04714.58
5.3.170.0170.05314.70
5.3.160.0170.05714.76
5.3.150.0130.05714.60
5.3.140.0130.05714.72
5.3.130.0270.04314.59
5.3.120.0300.04314.66
5.3.110.0230.04714.54
5.3.100.0230.05014.14
5.3.90.0270.06014.02
5.3.80.0200.05314.18
5.3.70.0270.04714.13
5.3.60.0170.05014.11
5.3.50.0270.04313.93
5.3.40.0170.05314.16
5.3.30.0200.05013.96
5.3.20.0170.05013.80
5.3.10.0170.05313.67
5.3.00.0170.05313.67
5.2.170.0200.04711.27
5.2.160.0300.04311.36
5.2.150.0230.03311.25
5.2.140.0130.04311.12
5.2.130.0170.04011.14
5.2.120.0130.04011.23
5.2.110.0200.03711.15
5.2.100.0170.03711.31
5.2.90.0170.04311.14
5.2.80.0130.04711.16
5.2.70.0170.04011.14
5.2.60.0200.03711.11
5.2.50.0200.05011.13
5.2.40.0030.05011.02
5.2.30.0100.04311.09
5.2.20.0100.04311.06
5.2.10.0170.03710.84
5.2.00.0100.04310.74
5.1.60.0100.03710.04
5.1.50.0170.03010.04
5.1.40.0130.03310.05
5.1.30.0070.04310.43
5.1.20.0230.04310.46
5.1.10.0230.04010.21
5.1.00.0130.04310.17
5.0.50.0170.0208.53
5.0.40.0070.0308.44
5.0.30.0000.0538.40
5.0.20.0100.0278.39
5.0.10.0100.0278.21
5.0.00.0130.0378.36
4.4.90.0030.0236.01
4.4.80.0030.0235.92
4.4.70.0030.0235.88
4.4.60.0030.0235.90
4.4.50.0100.0175.98
4.4.40.0000.0405.96
4.4.30.0130.0175.94
4.4.20.0030.0275.98
4.4.10.0070.0205.98
4.4.00.0030.0375.97
4.3.110.0070.0235.86
4.3.100.0030.0235.87
4.3.90.0170.0175.94
4.3.80.0030.0375.92
4.3.70.0070.0205.82
4.3.60.0100.0175.77
4.3.50.0130.0235.88
4.3.40.0100.0305.76
4.3.30.0070.0204.70
4.3.20.0030.0234.67
4.3.10.0030.0274.61
4.3.00.0100.0237.61

preferences:
42.72 ms | 401 KiB | 5 Q