static function remove($array, $search, $key = true)
{
if ($key) {
unset($array[$search]);
} else {
$found_all = false;
while (!$found_all) {
$index = array_search($search, $array);
if ($index !== false) {
unset($array[$index]);
} else {
$found_all = true;
}
}
}
return $array;
}