array_is_list

PHP 8 >= 8.1.0
array_is_list - Checks whether a given [array] is a list

array_is_list( array$array ): bool

Determines if the given array is a list. An array is considered a list if its keys consist of consecutive numbers from 0 to count($array)-1.

Parameters

array

The array being evaluated.

Return Values

Returns true if array is a list, false otherwise.

Notes

Note:

This function returns true on empty arrays.

Related Functions

Example of array_is_list

Show all examples for array_is_list

PHP Version: