A Comprehensive Reference of Array Functions in PHP

All these functions are used to interact with and manipulate arrays in different ways. They are part of the PHP core and you don't have to install anything to use these functions. Arrays can prove very useful when you are storing, managing, and operating on a set of variables.

  1. array_change_key_case — This function is used to change the case of all keys in an array.
  2. array_chunk — This function is used to split an array into chunks.
  3. array_column — This function is used to return the values from a single column in the input array.
  4. array_combine — This function is used to create an array by using one array for keys and another for its values.
  5. array_count_values — This function is used to count all the values of an array.
  6. array_diff_assoc — This function is used to compute the difference of arrays with additional index check.
  7. array_diff_key — This function is used to compute the difference of arrays using keys for comparison.
  8. array_diff_uassoc — This function is used to compute the difference of arrays with additional index check which is performed by a user supplied callback function.
  9. array_diff_ukey — This function is used to compute the difference of arrays using a callback function on the keys for comparison.
  10. array_diff — This function is used to compute the difference of arrays.
  11. array_fill_keys — This function is used to fill an array with values, specifying keys.
  12. array_fill — This function is used to fill an array with values.
  13. array_filter — This function is used to filter elements of an array using a callback function.
  14. array_flip — This function is used to exchange all keys with their associated values in an array.
  15. array_intersect_assoc — This function is used to compute the intersection of arrays with additional index check.
  16. array_intersect_key — This function is used to compute the intersection of arrays using keys for comparison.
  17. array_intersect_uassoc — This function is used to compute the intersection of arrays with additional index check, compares indexes by a callback function.
  18. array_intersect_ukey — This function is used to compute the intersection of arrays using a callback function on the keys for comparison.
  19. array_intersect — This function is used to compute the intersection of arrays.
  20. array_key_exists — This function is used to check if the given key or index exists in the array.
  21. array_keys — This function is used to return all the keys or a subset of the keys of an array.
  22. array_map — This function is used to apply the callback to the elements of the given arrays.
  23. array_merge_recursive — This function is used to merge two or more arrays recursively.
  24. array_merge — This function is used to merge one or more arrays.
  25. array_multisort — This function is used to sort multiple or multi-dimensional arrays.
  26. array_pad — This function is used to pad array to the specified length with a value.
  27. array_pop — This function is used to pop the element off the end of array.
  28. array_product — This function is used to calculate the product of values in an array.
  29. array_push — This function is used to push one or more elements onto the end of array.
  30. array_rand — This function is used to pick one or more random entries out of an array.
  31. array_reduce — This function is used to iteratively reduce the array to a single value using a callback function.
  32. array_replace_recursive — This function is used to replace elements from passed arrays into the first array recursively.
  33. array_replace — This function is used to replace elements from passed arrays into the first array.
  34. array_reverse — This function is used to return an array with elements in reverse order.
  35. array_search — This function is used to searche the array for a given value and returns the first corresponding key if successful.
  36. array_shift — This function is used to shift an element off the beginning of array.
  37. array_slice — This function is used to extract a slice of the array.
  38. array_splice — This function is used to remove a portion of the array and replace it with something else.
  39. array_sum — This function is used to calculate the sum of values in an array.
  40. array_udiff_assoc — This function is used to compute the difference of arrays with additional index check, compares data by a callback function.
  41. array_udiff_uassoc — This function is used to compute the difference of arrays with additional index check, compares data and indexes by a callback function.
  42. array_udiff — This function is used to compute the difference of arrays by using a callback function for data comparison.
  43. array_uintersect_assoc — This function is used to compute the intersection of arrays with additional index check, compares data by a callback function.
  44. array_uintersect_uassoc — This function is used to compute the intersection of arrays with additional index check, compares data and indexes by separate callback functions.
  45. array_uintersect — This function is used to compute the intersection of arrays, compares data by a callback function.
  46. array_unique — This function is used to remove duplicate values from an array.
  47. array_unshift — This function is used to prepend one or more elements to the beginning of an array.
  48. array_values — This function is used to return all the values of an array.
  49. array_walk_recursive — This function is used to apply a user function recursively to every member of an array.
  50. array_walk — This function is used to apply a user supplied function to every member of an array.
  51. array — This function is used to create an array.
  52. arsort — This function is used to sort an array in reverse order and maintain index association.
  53. asort — This function is used to sort an array and maintain index association.
  54. compact — This function is used to create array containing variables and their values.
  55. count — This function is used to count all elements in an array, or something in an object.
  56. current — This function is used to return the current element in an array.
  57. each — This function is used to return the current key and value pair from an array and advance the array cursor.
  58. end — This function is used to set the internal pointer of an array to its last element.
  59. extract — This function is used to import variables into the current symbol table from an array.
  60. in_array — This function is used to check if a value exists in an array.
  61. key_exists — This function is an alias of array_key_exists.
  62. key — This function is used to fetch a key from an array.
  63. krsort — This function is used to sort an array by key in reverse order.
  64. ksort — This function is used to sort an array by key.
  65. list — This function is used to assign variables as if they were an array.
  66. natcasesort — This function is used to sort an array using a case insensitive "natural order" algorithm.
  67. natsort — This function is used to sort an array using a "natural order" algorithm.
  68. next — This function is used to advance the internal pointer of an array.
  69. pos — This function is an alias of current.
  70. prev — This function is used to rewind the internal array pointer.
  71. range — This function is used to create an array containing a range of elements.
  72. reset — This function is used to set the internal pointer of an array to its first element.
  73. rsort — This function is used to sort an array in reverse order.
  74. shuffle — This function is used to shuffle an array.
  75. sizeof — This function is an alias of count.
  76. sort — This function is used to sort an array.
  77. uasort — This function is used to sort an array with a user-defined comparison function and maintain index association.
  78. uksort — This function is used to sort an array by keys using a user-defined comparison function.
  79. usort — This function is used to sort an array by values using a user-defined comparison function.

Follow Us For Updates

FacebookTwitterGoogle+
Go To Top