isIndexed.php
Table of Contents
Functions
- isIndexed() : bool
- Determines if an array is indexed (i.e., has sequential integer keys starting at 0).
Functions
isIndexed()
Determines if an array is indexed (i.e., has sequential integer keys starting at 0).
isIndexed(array<string|int, mixed> $array) : bool
An array is considered indexed if its keys are exactly the sequence 0, 1, 2, ... n-1, where n is the number of elements in the array. This is typical for arrays used as lists.
Empty arrays are considered indexed by definition.
Parameters
- $array : array<string|int, mixed>
-
The array to evaluate.
Tags
Return values
bool —True if the array is indexed, false otherwise.