From efcda1d37d609677b4fdc6a12c63feea250a3f5e Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 23 Feb 2023 09:51:37 +0000 Subject: port some functions from streams --- include/text.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include/text.php') 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. * -- cgit v1.2.3