What is the purpose of the array_keys() function in PHP?

  • To retrieve all the keys from an array
  • To sort the elements of an array
  • To filter the elements of an array
  • To reverse the order of elements in an array
The array_keys() function in PHP is used to retrieve all the keys from an array and return them in a new array. It extracts and returns the keys of the associative or indexed array. This function is useful when you need to work with only the keys of an array. Learn more: http://php.net/manual/en/function.array-keys.php
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *