PHP Array functions
A
The PHP array_all() function checks if all elements in an array satisfy a callback condition.
The PHP array_any() function checks if at least one element in an array satisfies a callback condition.
The PHP array_change_key_case() function returns an array with all keys from array changed to lowercase or uppercase.
The PHP array_chunk() function splits an array into chunks.
The PHP array_column() function returns the values from a single column in the input array.
The PHP array_combine() function creates an array by using one array for keys and another for values.
The PHP array_count_values() function counts all the values of an array.
The PHP array_diff() function computes the difference of arrays using values only.
The PHP array_diff_assoc() function compares the values and keys of two (or more) arrays, and returns the differences.
The PHP array_diff_key() function compares the keys of two (or more) arrays, and returns the differences.
The PHP array_diff_uassoc() function compares the values and keys of two (or more) arrays using a user-defined key comparison function, and returns the differences.
The PHP array_diff_ukey() function compares the keys of two (or more) arrays using a user-defined key comparison function, and returns the differences.
The PHP array_fill() function fills an array with values.
The PHP array_fill_keys() function fills an array with values, using keys from another array.
The PHP array_filter() function filters array elements using a callback.
The PHP array_find() function returns the first element that satisfies a given callback.
The PHP array_find_key() function returns the key of the first element that satisfies a given callback.
The PHP array_flip() function swaps keys and values in an array.
The PHP array_intersect() function computes the intersection of arrays using values.
The PHP array_intersect_assoc() function compares the values and keys of two (or more) arrays, and returns the matches.
The PHP array_intersect_key() function returns all elements from the first array whose keys are present in all other arrays.
The PHP array_intersect_uassoc() function computes the intersection of arrays with additional index check performed by a user-defined callback function.
The PHP array_intersect_ukey() function computes the intersection of arrays using a user-defined callback to compare keys.
The PHP array_is_list() function checks whether an array has sequential integer keys starting from 0 without gaps.
The PHP array_key_exists() function checks if a key exists in an array.
The PHP array_key_first() function returns the first key of an array without modifying the internal pointer.
The PHP array_key_last() function returns the last key of an array without modifying the internal pointer.
The PHP array_keys() function returns all the keys of an array.
The PHP array_map() function applies a callback to each element of an array.
The PHP array_merge() function merges one or more arrays.
The PHP array_merge_recursive() function merges arrays recursively, combining values with the same keys.
The PHP array_multisort() function sorts multiple arrays or multi-dimensional arrays at once.
The PHP array_pad() function pads an array to the specified length with a given value.
The PHP array_pop() function removes the last element of an array and returns it.
The PHP array_product() function calculates the product of values in an array.
The PHP array_push() function adds one or more elements to the end of an array.
The PHP array_rand() function picks one or more random keys from an array.
The PHP array_reduce() function reduces an array to a single value.
The PHP array_replace() function replaces values from the first array with values from following arrays.
The PHP array_replace_recursive() function replaces values recursively in multi-dimensional arrays.
The PHP array_reverse() function returns an array with elements in reverse order.
The PHP array_search() function searches for a value in an array and returns the corresponding key.
The PHP array_shift() function removes the first element from an array and returns it. Numeric keys are reindexed.
The PHP array_slice() function extracts a portion of an array.
The PHP array_splice() function removes or replaces elements in an array.
The PHP array_sum() function calculates the sum of values in an array.
The PHP array_udiff() function computes the difference of arrays using a user-defined comparison function for values.
The PHP array_udiff_assoc() function computes the difference of arrays using a user-defined callback for value comparison and also checks keys.
The PHP array_udiff_uassoc() function computes the difference of arrays using user-defined callbacks for both value and key comparison.
The PHP array_uintersect() function computes the intersection of arrays using a user-defined comparison function for values.
The PHP array_uintersect_assoc() function computes the intersection of arrays with additional index check and uses a user-defined comparison function for values.
The PHP array_uintersect_uassoc() function computes the intersection of arrays using user-defined callbacks for both value and key comparison.
The PHP array_unique() function removes duplicate values from an array.
The PHP array_unshift() function prepends one or more elements to the beginning of an array.
The PHP array_values() function returns all the values of an array and reindexes it.
The PHP array_walk() function applies a callback to each element of an array.
The PHP array_walk_recursive() function applies a callback to each element of an array recursively.
The PHP arsort() function sorts an array in descending order while maintaining index association.
C
The PHP count() function counts the number of elements in an array or Countable object.
I
The PHP in_array() function checks if a value exists in an array.
S
The PHP sizeof() function is an alias of count() and returns the number of elements in an array or Countable object.
U
The PHP uasort() function sorts an array by values while preserving keys.
The PHP uksort() function sorts an array by keys using a custom comparison function.
The PHP usort() function sorts an array by values using a custom comparison function.