We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2a1748d commit a3d3705Copy full SHA for a3d3705
src/Arr.php
@@ -19,20 +19,24 @@ public static function forget(&$array, $keys)
19
{
20
$original = &$array;
21
$keys = (array) $keys;
22
+
23
if (count($keys) === 0) {
24
return;
25
}
26
27
foreach ($keys as $key) {
28
// if the exact key exists in the top-level, remove it
29
if (static::exists($array, $key)) {
30
unset($array[$key]);
31
32
continue;
33
34
35
$parts = static::explode($key);
36
37
// clean up before each pass
38
$array = &$original;
39
40
while (count($parts) > 1) {
41
$part = array_shift($parts);
42
if (isset($array[$part]) && is_array($array[$part])) {
@@ -41,6 +45,7 @@ public static function forget(&$array, $keys)
45
continue 2;
46
43
47
48
44
49
unset($array[array_shift($parts)]);
50
51
0 commit comments