PHP Array Functions

hmm


Function Description PHP
array() Creates an array 4
array_change_key_case()Returns an array with all keys in lowercase or uppercase4
array_chunk()Splits an array into chunks of arrays4
array_combine()Creates an array by using one array for keys and another for its values5
array_count_values()Returns an array with the number of occurrences for each value4
array_diff()Compares array values, and returns the differences4
array_diff_assoc()Compares array keys and values, and returns the differences4
array_diff_key()Compares array keys, and returns the differences5
array_diff_uassoc()

Compares array keys and values, with an additional user-made function check, and returns the differences
5
array_diff_ukey()Compares array keys, with an additional user-made function check, and returns the differences5
array_fill()
Fills an array with values
4
array_fill_keys()Fills an array with values, specifying keys5.2
array_filter()Filters elements of an array using a user-made function4
array_flip()Exchanges all keys with their associated values in an array4
array_intersect()Compares array values, and returns the matches4
array_intersect_assoc()

Compares array keys and values, and returns the matches
4
array_intersect_key()

Compares array keys, and returns the matches
5
array_intersect_uassoc()

Compares array keys and values, with an additional user-made function check, and returns the matches
5
array_intersect_ukey()Compares array keys, with an additional user-made function check, and returns the matches5
array_key_exists()

Checks if the specified key exists in the array
4
array_keys()Returns all the keys of an array4
array_map()Sends each value of an array to a user-made function, which returns new values4
array_merge()Merges one or more arrays into one array4
array_merge_recursive()Merges one or more arrays into one array4
array_multisort()

Sorts multiple or multi-dimensional arrays
4
array_pad()

Inserts a specified number of items, with a specified value, to an array
4
array_pop()

Deletes the last element of an array
4
array_product()

Calculates the product of the values in an array
5
array_push()

Inserts one or more elements to the end of an array
4
array_rand()

Inserts one or more elements to the end of an array
4
array_reduce()Returns an array as a string, using a user-defined function4
array_replace()Replaces elements from passed arrays into the first array5.3
array_replace_recursive()Replaces elements from passed arrays into the first array recursively5.3
array_reverse()Returns an array in the reverse order4
array_search()

Searches an array for a given value and returns the key
4
array_shift()

Removes the first element from an array, and returns the value of the removed element
4
array_slice()
Returns selected parts of an array
4
array_splice()
Removes and replaces specified elements of an array
4
array_sum()
Returns the sum of the values in an array
4
array_udiff()
Compares array values in a user-made function and returns an array
5
array_udiff_assoc()Compares array keys, and compares array values in a user-made function, and returns an array5
array_udiff_uassoc()

Compares array keys and array values in user-made functions, and returns an array
5
array_uintersect()

Compares array values in a user-made function and returns an array
5
array_uintersect_assoc()

Compares array keys, and compares array values in a user-made function, and returns an array
5
array_uintersect_uassoc()Compares array keys and array values in user-made functions, and returns an array5
array_unique()Removes duplicate values from an array4
array_unshift()Adds one or more elements to the beginning of an array4
array_values()Returns all the values of an array4
array_walk()

Applies a user function to every member of an array
3
array_walk_recursive()

Applies a user function recursively to every member of an array
5
arsort()

Sorts an associative array in descending order, according to the value
4
asort()Sorts an associative array in ascending order, according to the value4
compact()

Create array containing variables and their values
4
count()

Create array containing variables and their values
4
current()

Returns the current element in an array
3
each()

Returns the current key and value pair from an array
3
end()Sets the internal pointer of an array to its last element3
extract()Imports variables into the current symbol table from an array3
in_array()Checks if a specified value exists in an array4
key()Fetches a key from an array3
krsort()

Sorts an associative array in descending order, according to the key
4
ksort()

Sorts an associative array in ascending order, according to the key
4
list()

Assigns variables as if they were an array
3
natcasesort()Sorts an array using a case insensitive "natural order" algorithm4
natsort()

Sorts an array using a "natural order" algorithm
4
next()

Advance the internal array pointer of an array
3
pos()

Alias of current()
3
prev()

Rewinds the internal array pointer
3
range()Creates an array containing a range of elements3
reset()Sets the internal pointer of an array to its first element3
rsort()

Sorts an indexed array in descending order
4
shuffle()

Shuffles an array
3
sizeof()

Alias of count()
4
sort()Sorts an indexed array in ascending order4
uasort()

Sorts an array by values using a user-defined comparison function
4
uksort()

Sorts an array by keys using a user-defined comparison function
4
usort()

Sorts an array using a user-defined comparison function
4