Home >Backend Development >PHP Tutorial >PHP Array, phparray_PHP Tutorial
Function |
Description |
array() |
Create an array. |
array_change_key_case() |
Returns an array whose keys are all uppercase or lowercase. |
array_chunk() |
Split an array into new array blocks. |
array_combine() |
Create a new array by merging two arrays. |
array_count_values() |
is used to count the number of occurrences of all values in the array. |
array_diff() |
Returns the difference array of two arrays. |
array_diff_assoc() |
Compare the key name and key value, and return the difference array of the two arrays. |
array_diff_key() |
Compare the key names and return the difference array of the two arrays. |
array_diff_uassoc() |
Calculate the difference set of the array by doing index checking through the callback function provided by the user. |
array_diff_ukey() |
Use the callback function to compare the key names and calculate the difference set of the array. |
array_fill() |
Fills the array with the given values. |
array_filter() |
Use the callback function to filter the elements in the array. |
array_flip() |
Swap the keys and values in the array. |
array_intersect() |
Calculate the intersection of arrays. |
array_intersect_assoc() |
Compares the key name and key value and returns the intersection array of the two arrays. |
array_intersect_key() |
Computes the intersection of arrays using key name comparison. |
array_intersect_uassoc() |
Calculate the intersection of arrays with index checking, and use callback functions to compare the indices. |
array_intersect_ukey() |
Use the callback function to compare the key names to calculate the intersection of the arrays. |
array_key_exists() |
Checks whether the given key or index exists in the array. |
array_keys() |
Returns all key names in the array. |
array_map() |
Apply the callback function to the cells of the given array. |
array_merge() |
Combine one or more arrays into one array. |
array_merge_recursive() |
Recursively merge one or more arrays. |
array_multisort() |
Sort multiple arrays or multidimensional arrays. |
array_pad() |
Pall the array to the specified length with values. |
array_pop() |
Pop (pop) the last element of the array. |
array_product() |
Calculates the product of all values in an array. |
array_push() |
Push one or more cells (elements) to the end of the array (push). |
array_rand() |
Randomly select one or more elements from the array and return it. |
array_reduce() |
Use a callback function to iteratively reduce the array to a single value. |
array_reverse() |
Reverse the order of elements in the original array, create a new array and return it. |
array_search() |
Search for the given value in the array and return the corresponding key name if successful. |
array_shift() |
Deletes the first element in the array and returns the value of the deleted element. |
array_slice() |
Remove a value from the array based on the condition and return it. |
array_splice() |
Remove a part of the array and replace it with other values. |
array_sum() |
Calculate the sum of all values in an array. |
array_udiff() |
Use callback function to compare data to calculate the difference of arrays. |
array_udiff_assoc() |
Calculate the difference set of arrays with index checking, and use callback functions to compare data. |
array_udiff_uassoc() |
With index check, calculate the difference set of the array, and use the callback function to compare the data and index. |
array_uintersect() |
Calculate the intersection of arrays and use callback functions to compare data. |
array_uintersect_assoc() |
Calculate the intersection of arrays with index checking and use callback functions to compare data. |
array_uintersect_uassoc() |
Calculate the intersection of arrays with index checking and use callback function to compare data and index. |
array_unique() |
Remove duplicate values from the array. |
array_unshift() |
Insert one or more elements at the beginning of the array. |
array_values() |
Returns all values in the array. |
array_walk() |
Apply a user function to each member of the array. |
array_walk_recursive() |
Apply the user function recursively to each member of the array. |
arsort() |
Sort the array in reverse order and maintain the index relationship. |
asort() |
Sort the array and maintain the index relationship. |
compact() |
Create an array including variable names and their values. |
count() |
Calculate the number of elements in an array or the number of attributes in an object. |
current() |
Returns the current element in the array. |
each() |
Returns the current key/value pair in the array and moves the array pointer forward one step. |
end() |
Sets the array's internal pointer to the last element. |
extract() |
Import variables from the array into the current symbol table. |
in_array() |
Checks whether the specified value exists in the array. |
key() |
Get the key name from the associative array. |
krsort() |
Sort the array in reverse order by key name. |
ksort() |
Sort the array by key name. |
list() |
Assign the values in the array to some variables. |
natcasesort() |
Sort the array in a case-insensitive manner using the "natural sorting" algorithm. |
natsort() |
Sort the array using the "natural sorting" algorithm. |
next() |
Moves the internal pointer in the array forward one position. |
pos() |
An alias for current(). |
prev() |
Rewind the internal pointer of the array by one bit. |
range() |
Creates an array containing the specified range of elements. |
reset() |
Set the internal pointer of the array to the first element. |
rsort() |
Sort the array in reverse order. |
shuffle() |
Rearrange the elements in the array in random order. |
sizeof() |
An alias for count(). |
sort() |
Sort the array. |
uasort() |
Use a user-defined comparison function to sort values in an array and maintain index association. |
uksort() |
Use a user-defined comparison function to sort the keys in the array. |
usort() |
Sort the values in an array using a user-defined comparison function. |