php array functions to classify and organize

Processing keys
 with array_change_key_case () is converted into an array of keys the size of uppercase or lowercase case_lower lowercase case_upper
the array_keys () returns an array of all the keys of
the array_search () function searches for a key-value in the array, and returns the corresponding keys.
key () to obtain keys from an associative array

 

Key processing

array_values () returns all of the values in the array
in_array whether the specified value is present () Check array

 

Array split and merge

array_chunk (array, size, false) to split the array into a plurality of arrays
array_combine (keys, values) by combining two arrays (a key to make a done value) to create an array
The array_merge () or a plurality of arrays into the an array
array_merge_recusive () recursively to an array or a plurality of arrays into
array_slice (array, start, length, preserve) function returns the selected portion of the array

 

Statistics, computing class

array_count_values () for all values of the number of occurrence statistics array
array_product (array) function calculates and returns the array product
array_sum () returns an array of all the values and
count () function returns the number of elements in an array
the sizeof () count () of aliases

 

 

Sort by category

array_multisort (array1, sorting order, sorting , type, array2, array3 ...); array in ascending order
array_reverse () in the order of elements in the array inverted, creates a new array and return to the

sort () array ascending numerical
rsort () descending numerical array
asort () according to the associated array in ascending sort key
arsort () array in descending order to the associated key
ksort () to the associated array by key ascending
krsort () to the associated array by key descending
usort () Comparative user-defined function to sort the array
uasort () using the comparison function of the user-defined key values array sorting
uksort () using the user-defined function keys of the array are sorted
natcasesort () natural array of sorting algorithms are not case-sensitive sorting
natsort () array with the natural order sorting algorithm

shuffle () the array of numeric values in descending reorder the function to assign a new name for the key elements in an array, the existing key will be deleted

 

 

Compare arrays

array_intersect () the comparison list, returns the intersection of two arrays (just compare keys)
array_intersect_assoc () the comparison list, returns the intersection of two arrays (compare key names and values)
array_intersect_key () the comparison list, returns the intersection of two arrays ( comparing only the keys)
array_intersect_uassoc () Comparative array, return the intersection of two arrays (Comparative key names and values, using keys for user-defined comparison function)
array_intersect_ukey () Comparative array, return the intersection of two arrays (key comparison only comparison function names using keys for user-defined)

in array_uintersect () Comparative array, return the intersection of two arrays (comparison only keys, function keys for comparison using a user-defined)
array_uintersect_assoc () array comparison, two arrays intersection (compare key names and values, using the function keys for comparison two user-defined)

array_diff () array comparison, the difference between return sets of the two arrays (compare only keys)
of array_diff_assoc () array comparison, two arrays the difference set (compare key names and values)
array_diff_key () compares the number of Return set difference of two arrays (compare only keys)
array_diff_uassoc () returns an array of comparing the difference between two sets of arrays (Comparative key names and values, user-defined function keys for comparison)
array_diff_ukey () array comparison, two return set a difference array (comparison only keys, function keys for comparison using the user-defined)

array_udiff () array comparison, the difference between return sets of the two arrays (comparison only keys using a user-defined function keys for comparison )
array_udiff_assoc () comparison array, the two arrays difference set (Comparative key names and values provided with the function keys Comparative keys using a custom function keys Comparative)
array_udiff_uassoc () array comparison, the difference between return sets of the two arrays (Comparative key names and values using keys for two user defined comparison function)

 

Filter, filter, replace, delete class array

array_filter () callback function with a filter element array
array_replace () array using the following values replace the first value of the array
array_replace_recurisive () array to replace the first end of the array used recursively value
array_splice () function from the array Removes selected elements, and replace him with a new element. The function also returns an array of elements removed
array_unique () function is used to remove duplicate values in array

 

Position of the operating element array

array_pop () the last element (the stack) Remove array
the array_push () function inserts one or more elements to the end of the array
array_shfit () to delete the first element in the array and returns the value of the removed element
current () returns an array current key, the value of
end () internal pointer to the last element of the array, and outputs the
next () internal pointer to the next element in the array, and outputs the
PREV () internal pointer to the last element in the array, and outputs the
reset () internal pointer to the first element in the array, and outputs
each () returns the key and the key of the current element, and the internal pointer is moved forward

 

other

array_column (array, column_key, index_key) returns the value of a single column of the input array of
array_fill_keys (keys, value) with the given key value specified key array filling
array_flip () function is used to reverse the exchange and keys in an array corresponding key
array_map () function is the user-defined function in the role of each given array value, and returns the new value
array_pad () the specified number of elements with the specified value inserted into the array
array_rand (array, number ) returns a random array of keys, the function returns the key to specify if more than one, an array containing the random key name is returned
array_walk () for each member of an array of user application function
array_walk_recursive () function for each of the array elements apply user-defined functions. In function, the key names and values of the array parameter. This function array_walk () function is that different operations can be deeper array (an array comprising another array)
Compact () to create an array of variable names and their values contained in the
extract () function will be introduced into the current array variables symbol table
list () function is used to set a variable assignment in
the array range () creates an element that contains the specified range
array_reduce (array, myfunction, initial) by using a user-defined function, iteratively reduce the array a string, and returns the initial value as an initial

 

Guess you like

Origin www.cnblogs.com/chxrs/p/11466562.html