The array functions allow you to manipulate arrays. It also allow you to access arrays.
Function Name
Description
array_column()
Returns the values from a single column in the input array
array_combine()
Creates an array by using the elements from one "keys" array and one "values" array
array_diff()
Compare arrays, and returns the differences (compare values only)
array_diff_key()
Compare arrays, and returns the differences (compare keys only)
array_diff_uassoc()
Compare arrays, and returns the differences (compare keys and values, using a user-defined key comparison function)
array_diff_ukey()
Compare arrays, and returns the differences (compare keys only, using a user-defined key comparison function)
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_uassoc()
Compare arrays, and returns the matches (compare keys and values, using a user-defined key comparison function)
array_intersect_ukey()
Compare arrays, and returns the matches (compare keys only, using a user-defined key comparison function)
array_map()
Sends each value of an array to a user-made function, which returns new values
array_pad()
Inserts a specified number of items, with a specified value, to an array
array_push()
Inserts one or more elements to the end of an array
array_reduce()
Returns an array as a string, using a user-defined function
array_replace()
Replaces the values of the first array with the values from following arrays
array_search()
Searches an array for a given value and returns the key
array_udiff()
Compare arrays, and returns the differences (compare values only, using a user-defined key comparison function)
array_udiff_assoc()
Compare arrays, and returns the differences (compare keys and values, using a built-in function to compare the keys and a user-defined function to compare the values)
array_udiff_uassoc()
Compare arrays, and returns the differences (compare keys and values, using two user-defined key comparison functions)
array_uintersect()
Compare arrays, and returns the matches (compare values only, using a user-defined key comparison function)
array_uintersect_assoc()
Compare arrays, and returns the matches (compare keys and values, using a built-in function to compare the keys and a user-defined function to compare the values)
array_uintersect_uassoc()
Compare arrays, and returns the matches (compare keys and values, using two user-defined key comparison functions)
array_walk()
Applies a user function to every member of an array
arsort()
Sorts an associative array in descending order, according to the value
asort()
Sorts an associative array in ascending order, according to the value
compact()
Create array containing variables and their values
count()
Returns the number of elements in an array
current()
Returns the current element in an array
each()
Returns the current key and value pair from an array
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()
Checks if a specified value exists in an array
key()
Fetches a key from an array
krsort()
Sorts an associative array in descending order, according to the key
ksort()
Sorts an associative array in ascending order, according to the key
list()
Assigns variables as if they were an array
natcasesort()
Sorts an array using a case insensitive "natural order" algorithm
natsort()
Sorts an array using a "natural order" algorithm
next()
Advance the internal array pointer of an array
prev()
Rewinds the internal array pointer
range()
Creates an array containing a range of elements
reset()
Sets the internal pointer of an array to its first element
rsort()
Sorts an indexed array in descending order
sort()
Sorts an indexed array in ascending order
uasort()
Sorts an array by values using a user-defined comparison function
uksort()
Sorts an array by keys using a user-defined comparison function
usort()
Sorts an array using a user-defined comparison function