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

  • To remove and return the first element of an array
  • To add an element to the end of an array
  • To sort the elements of an array
  • To reverse the order of elements in an array
The array_shift() function in PHP is used to remove and return the first element of an array. It modifies the original array by removing the first element and returns that element. This function is useful when you need to retrieve and remove the first element from an array. Learn more: http://php.net/manual/en/function.array-shift.php
Add your answer
Loading...

Leave a comment

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