File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -19,20 +19,24 @@ public static function forget(&$array, $keys)
19
19
{
20
20
$ original = &$ array ;
21
21
$ keys = (array ) $ keys ;
22
+
22
23
if (count ($ keys ) === 0 ) {
23
24
return ;
24
25
}
26
+
25
27
foreach ($ keys as $ key ) {
26
28
// if the exact key exists in the top-level, remove it
27
29
if (static ::exists ($ array , $ key )) {
28
30
unset($ array [$ key ]);
31
+
29
32
continue ;
30
33
}
31
34
32
35
$ parts = static ::explode ($ key );
33
36
34
37
// clean up before each pass
35
38
$ array = &$ original ;
39
+
36
40
while (count ($ parts ) > 1 ) {
37
41
$ part = array_shift ($ parts );
38
42
if (isset ($ array [$ part ]) && is_array ($ array [$ part ])) {
@@ -41,6 +45,7 @@ public static function forget(&$array, $keys)
41
45
continue 2 ;
42
46
}
43
47
}
48
+
44
49
unset($ array [array_shift ($ parts )]);
45
50
}
46
51
}
You can’t perform that action at this time.
0 commit comments