From 22e5f77e319a4a3b17946d84914a2cc26f873e76 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Mon, 26 Jan 2026 19:43:54 -0700 Subject: [PATCH] Add function array_type --- resources/functions.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/resources/functions.php b/resources/functions.php index f4d150b8d2..5a27a544bb 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -3274,6 +3274,21 @@ if (!function_exists('get_memory_details')) { } } +if (!function_exists('array_type')) { + /** + * Determines if the array is single or multi-dimensional array. + * + * @return string Options: single, multi + */ + function array_type(array $array): string { + $result = count($array, COUNT_RECURSIVE) > count($array); + if ($result) { + return 'multi'; + } + return 'single'; + } +} + if (!function_exists('mb_convert_encoding')) { function mb_convert_encoding($str, $to_encoding, $from_encoding = null) { // if no from_encoding specified, try to detect it