From 8d46b4f2997a79dd43bf924875968e24b512576e Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Mon, 4 Jan 2021 18:31:44 -0700 Subject: [PATCH] add alternative array_key_first for older verisons of PHP --- resources/functions.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/resources/functions.php b/resources/functions.php index a8cebede73..b7265a6b9c 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -2194,4 +2194,14 @@ function number_pad($number,$n) { } } -?> \ No newline at end of file +//add alternative array_key_first for older verisons of PHP + if (!function_exists('array_key_first')) { + function array_key_first(array $arr) { + foreach($arr as $key => $unused) { + return $key; + } + return NULL; + } + } + +?>