summaryrefslogtreecommitdiffstats
path: root/inc
diff options
context:
space:
mode:
Diffstat (limited to 'inc')
-rw-r--r--inc/arrayutil.inc.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/inc/arrayutil.inc.php b/inc/arrayutil.inc.php
index d82cdbeb..9d2dcfae 100644
--- a/inc/arrayutil.inc.php
+++ b/inc/arrayutil.inc.php
@@ -66,4 +66,17 @@ class ArrayUtil
return true;
}
+ /**
+ * Check if all elements in given array are primitive types,
+ * i.e. not object, array or resource.
+ */
+ public static function isOnlyPrimitiveTypes(array $array): bool
+ {
+ foreach ($array as $item) {
+ if (is_array($item) || is_object($item) || is_resource($item))
+ return false;
+ }
+ return true;
+ }
+
} \ No newline at end of file