PHP provides a variety of array functions to manipulate and work with arrays. Here are some commonly used array functions in PHP:

  1. array(): Creates an array. $arr = array(1, 2, 3);
  2. count(): Returns the number of elements in an array. $count = count($arr);
  3. array_push(): Pushes one or more elements onto the end of an array. array_push($arr, 4, 5);
  4. array_pop(): Pops the last element off the end of an array. $lastElement = array_pop($arr);
  5. array_shift(): Shifts an element off the beginning of an array. $firstElement = array_shift($arr);
  6. array_unshift(): Prepends one or more elements to the beginning of an array. array_unshift($arr, 0, -1);
  7. array_merge(): Merges one or more arrays into one array. $newArray = array_merge($arr1, $arr2);
  8. array_slice(): Returns a portion of an array. $subset = array_slice($arr, 1, 2);
  9. array_splice(): Removes a portion of the array and returns it. $removed = array_splice($arr, 1, 2);
  10. array_reverse(): Reverses the order of the elements in an array. $reversedArray = array_reverse($arr);
  11. array_search(): Searches an array for a given value and returns the corresponding key if successful. $key = array_search(2, $arr);
  12. in_array(): Checks if a value exists in an array. $exists = in_array(3, $arr);
  13. array_key_exists(): Checks if the given key or index exists in the array. $exists = array_key_exists('key', $arr);
  14. array_values(): Returns all the values of an array. $values = array_values($arr);
  15. array_keys(): Returns all the keys of an array. $keys = array_keys($arr);

These are just a few examples, and PHP has many more array functions to suit various needs. Refer to the official PHP documentation for a comprehensive list and detailed information on each function.

Tagged in: