Skip to content

Commit 6c32391

Browse files
committed
IHF: array_except_value helper added.
1 parent 3eaf5eb commit 6c32391

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/array.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
if (!function_exists('array_except_value')) {
4+
function array_except_value($array, $value)
5+
{
6+
if (!is_array($value)) {
7+
$value = [$value];
8+
}
9+
10+
foreach ($value as $item) {
11+
$key = array_search($item, $array);
12+
if ($key !== false) {
13+
unset($array[$key]);
14+
}
15+
}
16+
17+
return $array;
18+
}
19+
}

0 commit comments

Comments
 (0)