Skip to content

Commit 0e8439e

Browse files
authored
Update helpers.php
1 parent cf31db4 commit 0e8439e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/helpers.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,18 @@ function variadic_array(array $items): array
3232
return $items;
3333
}
3434
}
35+
36+
// todo test
37+
if (! function_exists('array_without')) {
38+
/** Remove value(s) from an array */
39+
function array_without(array $array, mixed ...$values): array
40+
{
41+
foreach (variadic_array($values) as $value) {
42+
if (($key = array_search($value, $array)) !== false) {
43+
unset($array[$key]);
44+
}
45+
}
46+
47+
return $array;
48+
}
49+
}

0 commit comments

Comments
 (0)