From 0e8439eaf27a17425dbe7cd5c4c4d5289a58827a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Thu, 9 Dec 2021 12:30:42 +0100 Subject: [PATCH] Update helpers.php --- src/helpers.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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; + } +}