Home > PHP > Extension > Arrays

Arrays

basic.vartype
Sort
  • array_multisort (arr, arg, arg, ...) - Sort multiple or multi-dimensional arrays
  • arsort (array, sort_flags) - Sort an array in reverse order and maintain index association
  • asort (array, sort_flags) - Sort an array and maintain index association
  • krsort (array, sort_flags) - Sort an array by key in reverse order
  • ksort (array, sort_flags) - Sort an array by key
  • natcasesort (array) - Sort an array using a case insensitive "natural order" algorithm
  • natsort (array) - Sort an array using a "natural order" algorithm
  • rsort (array, sort_flags) - Sort an array in reverse order
  • sort (array, sort_flags) - Sort an array
  • uasort (array, cmp_function) - Sort an array with a user-defined comparison function and maintain index association
  • uksort (array, cmp_function) - Sort an array by keys using a user-defined comparison function
  • usort (array, cmp_function) - Sort an array by values using a user-defined comparison function
Traverse
  • array_walk (array, funcname, userdata) - Apply a user function to every member of an array
  • current (array) - Return the current element in an array
  • each (array) - Return the current key and value pair from an array and advance the array cursor
  • end (array) - Set the internal pointer of an array to its last element
  • key (array) - Fetch a key from an array
  • next (array) - Advance the internal array pointer of an array
  • reset (array) - Set the internal pointer of an array to its first element
Advanced
  • array_diff (array1, array2, ...) - Computes the difference of arrays
  • array_intersect (array1, array2, ...) - Computes the intersection of arrays
  • array_merge (array1, array2, ...) - Merge one or more arrays
  • array_merge_recursive (array1, ...) - Merge two or more arrays recursively
  • array_slice (array, offset, length, preserve_keys) - Extract a slice of the array
  • array_splice (input, offset, length, replacement) - Remove a portion of the array and replace it with something else
  • array (input, offset, length, replacement) - Create an array
  • array_change_key_case (input, case) - Changes all keys in an array
  • array_chunk (input, size, preserve_keys) - Split an array into chunks
  • array_combine (keys, values) - Creates an array by using one array for keys and another for its values
  • array_count_values (input) - Counts all the values of an array
  • array_diff_assoc (array1, array2, ...) - Computes the difference of arrays with additional index check
  • array_diff_key (array1, array2, ...) - Computes the difference of arrays using keys for comparison
  • array_diff_uassoc (array1, array2, ..., key_compare_func) - Computes the difference of arrays with additional index check which is performed by a user supplied callback function
  • array_diff_ukey (array1, array2, ..., key_compare_func) - Computes the difference of arrays using a callback function on the keys for comparison
  • array_fill (start_index, num, value) - Fill an array with values
  • array_fill_keys (keys, value) - Fill an array with values, specifying keys
  • array_filter (input, callback) - Filters elements of an array using a callback function
  • array_flip (trans) - Exchanges all keys with their associated values in an array
  • array_intersect_assoc (array1, array2, ...) - Computes the intersection of arrays with additional index check
  • array_intersect_key (array1, array2, ...) - Computes the intersection of arrays using keys for comparison
  • array_intersect_uassoc (array1, array2, ..., key_compare_func) - Computes the intersection of arrays with additional index check, compares indexes by a callback function
  • array_intersect_ukey (array1, array2, ..., key_compare_func) - Computes the intersection of arrays using a callback function on the keys for comparison
  • array_keys (input, search_value, strict) - Return all the keys of an array
  • array_key_exists (key, search) - Checks if the given key or index exists in the array
  • array_map (callback, arr1, ...) - Applies the callback to the elements of the given arrays
  • array_pad (input, pad_size, pad_value) - Pad array to the specified length with a value
  • array_pop (array) - Pop the element off the end of array
  • array_product (array) - Calculate the product of values in an array
  • array_push (array, var, ...) - Push one or more elements onto the end of array
  • array_rand (input, num_req) - Pick one or more random entries out of an array
  • array_reduce (input, function, initial) - Iteratively reduce the array to a single value using a callback function
  • array_replace (array, array1, array2, ...) - Replaces elements from passed arrays into the first array
  • array_replace_recursive (array, array1, array2, ...) - Replaces elements from passed arrays into the first array recursively
  • array_reverse (array, preserve_keys) - Return an array with elements in reverse order
  • array_search (needle, haystack, strict) - Searches the array for a given value and returns the corresponding key if successful
  • array_shift (array) - Shift an element off the beginning of array
  • array_sum (array) - Calculate the sum of values in an array
  • array_udiff (array1, array2, ..., data_compare_func) - Computes the difference of arrays by using a callback function for data comparison
  • array_udiff_assoc (array1, array2, ..., data_compare_func) - Computes the difference of arrays with additional index check, compares data by a callback function
  • array_udiff_uassoc (array1, array2, ..., data_compare_func, key_compare_func) - Computes the difference of arrays with additional index check, compares data and indexes by a callback function
  • array_uintersect (array1, array2, ..., data_compare_func) - Computes the intersection of arrays, compares data by a callback function
  • array_uintersect_assoc (array1, array2, ..., data_compare_func) - Computes the intersection of arrays with additional index check, compares data by a callback function
  • array_uintersect_uassoc (array1, array2, ..., data_compare_func, key_compare_func) - Computes the intersection of arrays with additional index check, compares data and indexes by a callback functions
  • array_unique (array, sort_flags) - Removes duplicate values from an array
  • array_unshift (array, var, ...) - Prepend one or more elements to the beginning of an array
  • array_values (input) - Return all the values of an array
  • array_walk_recursive (input, funcname, userdata) - Apply a user function recursively to every member of an array
  • compact (varname, ...) - Create array containing variables and their values
  • count (var, mode) - Count all elements in an array, or properties in an object
  • extract (var_array, extract_type, prefix) - Import variables into the current symbol table from an array
  • in_array (needle, haystack, strict) - Checks if a value exists in an array
  • list (varname, ...) - Assign variables as if they were an array
  • pos (varname, ...) - Alias of current()
  • prev (array) - Rewind the internal array pointer
  • range (low, high, step) - Create an array containing a range of elements
  • shuffle (array) - Shuffle an array
  • sizeof (array) - Alias of count()