We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c7c4edc commit d554a0aCopy full SHA for d554a0a
src/helper.php
@@ -288,3 +288,30 @@ function class_uses_recursive($class): array
288
return array_unique($results);
289
}
290
291
+
292
+if (!function_exists('array_is_list')) {
293
+ /**
294
+ * 判断数组是否为list
295
+ *
296
+ * @param array $array 数据
297
+ * @return bool
298
+ */
299
+ function array_is_list(array $array): bool
300
+ {
301
+ return array_values($array) === $array;
302
+ }
303
+}
304
305
+if (!function_exists('json_validate')) {
306
307
+ * 判断是否为有效json数据
308
309
+ * @param string $string 数据
310
311
312
+ function json_validate(string $string): bool
313
314
+ json_decode($string);
315
+ return json_last_error() === JSON_ERROR_NONE;
316
317
0 commit comments