1
0
Fork 0
mirror of https://github.com/archtechx/helpers.git synced 2025-12-12 04:04:04 +00:00

Update helpers.php

This commit is contained in:
Samuel Štancl 2021-12-09 12:30:42 +01:00 committed by GitHub
parent cf31db4036
commit 0e8439eaf2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -32,3 +32,18 @@ if (! function_exists('variadic_array')) {
return $items; 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;
}
}