From: cajus Date: Thu, 30 Oct 2008 16:10:17 +0000 (+0000) Subject: Updated in_array_ics to be more speedy X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=774ce2c24a61cda087c85578c21f23e178c7b83d;p=gosa.git Updated in_array_ics to be more speedy git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12835 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index 562a48f60..ca6b487f5 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -1772,18 +1772,8 @@ function to_byte($value) { function in_array_ics($value, $items) { - if (!is_array($items)){ - return (FALSE); - } - - foreach ($items as $item){ - if (strcasecmp($item, $value) == 0) { - return (TRUE); - } - } - - return (FALSE); -} + return preg_grep('/^'.preg_quote($value, '/').'$/i', $items); +} function generate_alphabet($count= 10)