From 4dfd930ee9af1e9d98f3c41c51d9dec8c3bf34bb Mon Sep 17 00:00:00 2001 From: Darren Embry Date: Thu, 10 May 2012 15:16:31 -0400 Subject: cleanup: code for building arrays for autocompleted fields --- etc/inc/util.inc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'etc/inc/util.inc') diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 5539400..a052fbc 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -1773,4 +1773,17 @@ function get_alias_list($type = null) { return $result; } +/* returns an array consisting of every element of $haystack that is not equal to $needle. */ +function array_exclude($needle, $haystack) { + $result = array(); + if (is_array($haystack)) { + foreach ($haystack as $thing) { + if ($needle !== $thing) { + $result[] = $thing; + } + } + } + return $result; +} + ?> -- cgit v1.1