Useful Array Functions

Can be found at: PHP Manual -- Array Functions


array -- Creates an array

array_change_key_case -- Returns an array with all string keys lowercase or uppercase

array_chunk -- Splits an array into chunks

array_combine -- Creates an array by using one array for keys and another for its values

array_count_values -- Counts all the values of an array

count -- Counts all the elements in an array, or properties in an object

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 -- Computes the difference of arrays

array_fill_keys -- Fills an array with values, specifying keys

array_fill -- Fills an array with values

array_flip -- Exchanges all keys with their associated values in an array

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 -- Computes the intersection of arrays

array_key_exists -- Checks if the given key or index exists in the array

array_keys -- Returns all the keys of an array

array_merge -- Merges one or more arrays

array_pad -- Pads an array to the specified length with a value

array_pop -- Pops the element off the end of array

array_push -- Pushes one or more elements onto the end of array

array_shift -- Shifts an element off the beginning of array

array_unshift -- Prepends one or more elements to the beginning of an array

array_product -- Calculates the product of values in an array

array_rand -- Pickes one or more random entries out of an array

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_slice -- Extracts a slice of the array

array_splice -- Removes a portion of the array and replaces it with something else

array_sum -- Calculates the sum of values in an array

array_unique -- Removes duplicate values from an array

array_values -- Returns all the values of an array

array_walk -- Applies a user function to every member of an array

compact -- Creates an array containing variables and their values

current -- Returns the current element in an array

key -- Fetches a key from an associative array

pos -- Alias of current()

next -- Advances the internal array pointer

prev -- Rewinds the internal array pointer

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

reset -- Sets the internal pointer of an array to its first element

in_array -- Checks if a value exists in an array

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

range -- Creates an array containing a range of elements

shuffle -- Shuffles an array

sizeof -- Alias of count()

sort -- Sorts an array

rsort -- Sorts an array in reverse order

arsort -- Sorts an array in reverse order and maintains index association

asort -- Sorts an array and maintains index association

krsort -- Sorts an array by key in reverse order

ksort -- Sorts an array by key

array_multisort -- Sorts multiple or multi-dimensional arrays