From 774ce2c24a61cda087c85578c21f23e178c7b83d Mon Sep 17 00:00:00 2001 From: cajus Date: Thu, 30 Oct 2008 16:10:17 +0000 Subject: [PATCH] Updated in_array_ics to be more speedy git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12835 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/functions.inc | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) 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) -- 2.30.2