Sfoglia il codice sorgente

add alternative array_key_first for older verisons of PHP

FusionPBX 4 anni fa
parent
commit
56cbab8d31
1 ha cambiato i file con 11 aggiunte e 1 eliminazioni
  1. 11 1
      resources/functions.php

+ 11 - 1
resources/functions.php

@@ -2194,4 +2194,14 @@ function number_pad($number,$n) {
 		}
 	}
 
-?>
+//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;
+	    }
+	}
+
+?>