# PHP Array Functions

PHP's built in Array Function provide a convenient way to perform operations on arrays, such as sorting, searching, filtering, and transforming the elements of an array.

Some common tasks that can be performed using PHP array functions include:

- Sorting an array by its values or keys
- Removing duplicate values from an array
- Filtering an array to include only certain elements that meet certain criteria
- Merging multiple arrays into a single array
- Transforming the values of an array using a callback function
- Searching for a specific value or key in an array
- Counting the number of elements in an array

Here is a complete list of PHP's Array Functions:

Function name | Description |
---|---|

`array_change_key_case` | Changes the case of all keys in an array. |

`array_chunk` | Splits an array into chunks of new arrays. |

`array_column` | Returns the values from a single column of an input array, identified by the column_key. |

`array_combine` | Creates an array by using the values from one array as keys and the values from another array as the corresponding values. |

`array_count_values` | Counts all the values of an array. |

`array_diff` | Computes the difference of arrays. |

`array_diff_assoc` | Computes the difference of arrays with additional index check. |

`array_diff_key` | Computes the difference of arrays using keys for comparison. |

`array_diff_uassoc` | Computes the difference of arrays with additional index check which is performed by a user supplied callback function. |

`array_diff_ukey` | Computes the difference of arrays using a callback function on the keys for comparison. |

`array_fill` | Fills an array with values. |

`array_fill_keys` | Fills an array with values, specifying keys. |

`array_filter` | Filters the values of an array using a callback function. |

`array_flip` | Flips/exchanges all keys with their associated values in an array. |

`array_intersect` | Computes the intersection of arrays. |

`array_intersect_assoc` | Computes the intersection of arrays with additional index check. |

`array_intersect_key` | Computes the intersection of arrays using keys for comparison. |

`array_intersect_uassoc` | Computes the intersection of arrays with additional index check, compares indexes by a callback function. |

`array_intersect_ukey` | Computes the intersection of arrays using a callback function on the keys for comparison. |

`array_key_exists` | Checks if the given key or index exists in the array. |

`array_keys` | Returns all the keys or a subset of the keys of an array. |

`array_map` | Applies a callback function to the elements of an array. |

`array_merge` | Merges one or more arrays into one array. |

`array_merge_recursive` | Recursively merges two or more arrays into one array. |

`array_multisort` | Sorts multiple or multi-dimensional arrays. |

`array_pad` | Pad array to the specified length with a value. |

`array_pop` | Removes the last element of an array, and returns the value of the removed element. |

`array_product` | Calculates the product of the values in an array. |

`array_push` | Pushes one or more elements onto the end of an array. |

`array_rand` | Picks one or more random entries out of an array. |

`array_reduce` | Iteratively reduce the array to a single value using a callback function. |

`array_replace` | Replaces elements from passed arrays into the first array recursively. |

`array_replace_recursive` | Replaces elements from passed arrays into the first array recursively. |

`array_reverse` | Returns an array with elements in reverse order. |

`array_search` | Searches the array for a given value and returns the corresponding key if successful. |

`array_shift` | Removes the first element of an array, and returns the value of the removed element. |

`array_slice` | Extracts a slice of an array. |

`array_splice` | Removes and replaces specified elements of an array. |

`array_sum` | Calculates the sum of the values in an array. |

`array_udiff` | Computes the difference of arrays by using a callback function for data comparison. |

`array_uintersect_assoc` | Computes the intersection of arrays with additional index check, compares data by a callback function. |

`array_uintersect_uassoc` | Computes the intersection of arrays with additional index check, compares indexes by a callback function. |

`array_unique` | Removes duplicate values from an array. |

`array_unshift` | Prepends one or more elements to an array. |

`array_values` | Returns all the values of an array. |

`array_walk` | Apply a user function to every member of an array. |

`array_walk_recursive` | Apply a user function recursively to every member of an array. |

`arsort` | Sorts an array in reverse order and maintains index association. |

`asort` | Sorts an array and maintains index association. |

`compact` | Creates an array containing variables and their values. |

`count` | Counts all elements in an array, or something in an object. |

`current` | Returns the current element in an array. |

`each` | Returns the current key and value pair from an array and advances the array cursor. |

`end` | Sets the internal pointer of an array to its last element. |

`extract` | Imports variables into the current symbol table from an array. |

`in_array` | Searches an array for a specific value. |

`key` | Returns the key of the element currently pointed to by the internal array pointer. |

`key_exists` | Checks if the given key or index exists in the array. |

`krsort` | Sorts an array by key in reverse order. |

`ksort` | Sorts an array by key. |

`natcasesort` | Sorts an array using a case insensitive "natural order" algorithm. |

`natsort` | Sorts an array using a "natural order" algorithm. |

`next` | Advances the internal pointer of an array to the next element, and returns the value of the current element after the increment. |

`pos` | Alias of current(). |

`prev` | Rewinds the internal array pointer to the previous element and returns its value. |

`range` | Creates an array containing a range of elements. |

`reset` | Rewinds array's internal pointer to the first element and returns the value of the first array element. |

`rsort` | Sorts an array in reverse order. |

`shuffle` | Shuffles an array. |

`sizeof` | Alias of count(). |

`sort` | Sorts an array. |

`uasort` | Sorts an array with a user-defined comparison function and maintains index association. |

`uksort` | Sorts an array by keys using a user-defined comparison function. |

`usort` | Sorts an array by values using a user-defined comparison function. |