aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/text.php')
-rw-r--r--include/text.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/text.php b/include/text.php
index a09d1bd7b..d7ffa5550 100644
--- a/include/text.php
+++ b/include/text.php
@@ -3505,6 +3505,14 @@ function flatten_array_recursive($arr) {
return($ret);
}
+// Turn $element into an array if it isn't already.
+function force_array($element) {
+ if (empty($element)) {
+ return [];
+ }
+ return (is_array($element)) ? $element : [$element];
+}
+
/**
* @brief Highlight Text.
*