Skip to content

Commit 8373d94

Browse files
committed
fixed: is_collection() helper function
1 parent e77a046 commit 8373d94

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

helpers/presento.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,14 @@ function get_from_array($map, string $node)
5353
/**
5454
* Check given value is multidimensional array
5555
*
56-
* @param mixed $arr
56+
* @param mixed $array
5757
* @return bool
5858
*/
59-
function is_collection($arr) : bool
59+
function is_collection($array) : bool
6060
{
61-
if (!is_array($arr)) {
62-
return false;
63-
}
64-
65-
$first = reset($arr);
66-
//$key = key($first);
61+
if (!is_array($array)) return false;
6762

68-
return isset($first) && is_array($first);
63+
return array_keys($array) === range(0, count($array) - 1);
6964
}
7065
}
7166

0 commit comments

Comments
 (0)