PHP array_is_list() Function Last Updated : 22 Jul, 2022 Summarize Comments Improve Suggest changes Share Like Article Like Report The array_is_list() function is an inbuilt function in PHP that is used to check whether a given array is a list or not. If the given array will be a list if the key of the array contains consecutive numbers from 0 to count($arr)-1. Syntax: bool array_is_list(array $array) Parameters: This function accepts one parameter $array that will check for the list. Return Value: This function returns true if the given array is a list and false otherwise. Note: This function returns true on an empty array. Example 1: PHP <?php $arr1 = array("10", "20", "30", "40", "50"); var_dump(array_is_list($arr1)); $arr2 = array( 'Geeks' => "HTML", 'GFG' => "CSS", 'Geek' => "JavaScript", 'G4G' => "PHP" ); var_dump(array_is_list($arr2)); ?> Output: bool(true) bool(false) Example 2: PHP <?php var_dump(array_is_list([])); var_dump(array_is_list(array( "10" => "Geeks", "20" => "GeeksforGeeks", "30", "40", "50" ))); var_dump(array_is_list( array(5, 10, 15, 20, 25) )); ?> Output: bool(true) bool(false) bool(true) Note: This function works on PHP 8.1.0 or higher versions. Reference: https://www.php.net/manual/en/function.array-is-list.php Comment More infoAdvertise with us Next Article PHP | is_a() function V vkash8574 Follow Improve Article Tags : Web Technologies PHP PHP-array PHP-function Similar Reads PHP | is_array() Function The is_array() is an inbuilt function in PHP. The is_array() function is used to check whether a variable is an array or not. Syntax: bool is_array($variable_name) Parameter: This function accept a single parameter as mentioned above and described below: $variable_name: This parameter holds the vari 2 min read PHP in_array() Function The in_array() function in PHP is a built-in function that is used to check if a specific value exists within an array and returns a boolean result. Returns true if the value is found and false if the value is not found.Syntax:bool in_array(mixed $needle, array $haystack, bool $strict = false)In thi 3 min read PHP Array Functions Arrays are one of the fundamental data structures in PHP. They are widely used to store multiple values in a single variable and can store different types of data, such as strings, integers, and even other arrays. PHP offers a large set of built-in functions to perform various operations on arrays. 7 min read PHP | is_a() function The is_a() is a built-in function in PHP and is used to check whether a given object is of a given class or not. It also checks if the given class is one of the parents of the given object or not. Syntax: boolean is_a($object, $class) Parameters: This function accepts two parameters as shown in the 2 min read PHP list() Function The list() function is an inbuilt function in PHP which is used to assign array values to multiple variables at a time. This function will only work on numerical arrays. When the array is assigned to multiple values, then the first element in the array is assigned to the first variable, second to th 2 min read PHP | is_link( ) Function The is_link() function in PHP used to check whether the specified file is a symbolic link or not. The path to the file is sent as a parameter to the is_link() function and it returns TRUE if the filename exists and is a symbolic link, otherwise it returns FALSE. Syntax: is_link(file) Parameters Used 2 min read Like