PHP ARRAY FUNCtIONS





PHP has a great deal of support for working with arrays built in. There are many string functions built into PHP-and there are plenty of arrays functions as well. You can see them in below:

Functions Does This
array_change_key_case Returns an array with all string keys converted to lowercase or uppercase
array_chunk Splits an array into chunks
array_combine Creates an array by using one array for the keys and another for the values
array_count_value Counts the values in an array
array_diff_assoc Computes the difference of two arrays with additional index check
array_diff_uassoc Computes the difference of two arrays with additional index check, performed by a user-supplied callback function
array_diff Computes the difference of arrays
array_fill Fill an array with values
array_filter Filter elements of an array using a callback function
array_flip Exchange all key with their associated values in an array
array_intersect_assoc Computes the intersection of arrays with additional index check
array_intersect Computes the intersection of array
array_key_exists Check if the given key or index exists in the array
array_keys Returns the key in an array
array_map Applies the callback to the elements of the given arrays
array_merge_recursive Merges two or more arrays recursively
array_merge Merges two or more arrays
array-multisort Sort Multiple or Multidimensional arrays
array_pad Pad array to the specified length with a value
array_pop Pops the element off the end of array
array_push Pushes one or more random elements out of an array
array_rand Picks one or more random elements out of an array
array_reduce Reduces the array to a single value with a callback function
array_reverse Returns ana array with elements in reverse order
array-search Searches the array for a given value and returns the corresponding key
array_shift Shifts an element off the beginning of an array
array_slice Extract a slice of the array
array_splice Remove part of the aray and replace it with something else
array_sum Calculates the sum of values in an array
array_udiff_assoc Computes the difference of arrays with an additional index check. Here, the data is compared by using a callback function
array_udiff_uassoc Computes the difference of arrays with an index check. Here, the data is compared by using a callback function, and the index check is also performed by callback function
array_udiff Computes the difference between arrays by using a callback function
array_unique Remove duplicate elements from an arrays
array_unshift Adds one or more elements to the beginning of an array
array_values Returns all the values of an array
array_walk Calls a user-supplied function on every member of an array
array Create an array
arsort Sorts an array in order, preserving index association
asort Sort and array and maintains index association
compact Creates array containing variables and their values
count Counts the elements in an array
current Returns the current element in an array
each Returns the current key and values pair an array and advances the array cursor
end Sets the array pointer to the last elements
extract Imports variables into the current symbol table from an array
in_array Check if the value exists in an array
key Gets a key from an associative array
krsort Sorts an array by key in reverse order
ksort Sorts an array by 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 Advances the array pointer of an array
pos Alias of the current function
prev Moves the array pointer back on elements
range Creates an array containing a range of elements
reset Sets the pointer of an array to its first elements
rsort Sorts an array in reverse order
shuffle Shuffles an array's elements
sizeof Alias of the count function
sort Sorts an array
uasort Sorts an array with a user-defined comparison functions, maintaining indexes
uksort Sorts an array bby keys; uses a user-defined comparison function
usort Sorts an array by values; uses a user-defined comparison function

Post a Comment

0 Comments