diff --git a/src/helpers.php b/src/helpers.php index 5a5c74d..a4b50d2 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -32,3 +32,18 @@ if (! function_exists('variadic_array')) { return $items; } } + +// todo test +if (! function_exists('array_without')) { + /** Remove value(s) from an array */ + function array_without(array $array, mixed ...$values): array + { + foreach (variadic_array($values) as $value) { + if (($key = array_search($value, $array)) !== false) { + unset($array[$key]); + } + } + + return $array; + } +}