mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2024-09-19 19:22:14 +02:00
functions.inc.php
- new function remove_from_array() git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1343 a1433add-5e2c-0410-b055-b7f2511e0802
This commit is contained in:
parent
4e5bd47183
commit
b0277b6c03
@ -1262,6 +1262,23 @@ function hex2bin ($str) {
|
||||
}
|
||||
return $nstr;
|
||||
}
|
||||
|
||||
/*
|
||||
* remove item $item from array $array
|
||||
*/
|
||||
function remove_from_array($array, $item) {
|
||||
# array_diff might be faster, but doesn't provide an easy way to know if the value was found or not
|
||||
# return array_diff($array, array($item));
|
||||
$ret = array_search($item, $array);
|
||||
if ($ret === false) {
|
||||
$found = 0;
|
||||
} else {
|
||||
$found = 1;
|
||||
unset ($array[$ret]);
|
||||
}
|
||||
return array($found, $array);
|
||||
}
|
||||
|
||||
/**/ }
|
||||
|
||||
function to64 ($v, $n) {
|
||||
|
Loading…
Reference in New Issue
Block a user