We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 86df3b8 commit 10dd4e6Copy full SHA for 10dd4e6
1 file changed
src/TgUtils/Utils.php
@@ -121,4 +121,14 @@ public static function isEmpty($s) {
121
return strlen(trim($s)) == 0;
122
}
123
124
+ /**
125
+ * Checks whether an array is associative or not.
126
+ * @param array $arr - the array to be tested
127
+ * @return boolean TRUE - when array is associative, FALSE otherwise
128
+ */
129
+ public static isAssoc(array $arr) {
130
+ if (array() === $arr) return FALSE;
131
+ return array_keys($arr) !== range(0, count($arr)-1);
132
+ }
133
+
134
0 commit comments