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:
parent
cf31db4036
commit
0e8439eaf2
1 changed files with 15 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue