PHP Array Functions
PHP Array Introduction
The array functions allow you to access and manipulate arrays.
Simple and multi-dimensional arrays are supported.
Installation
The array functions are part of the PHP core. There is no installation needed to use these functions.
PHP Array Functions
Function | 描述 |
---|---|
大批() | Creates an array |
数组更改键值() | Changes all keys in an array to lowercase or uppercase |
array_chunk() | Splits an array into chunks of arrays |
数组列() | Returns the values from a single column in the input array |
数组合并() | Creates an array by using the elements from one "keys" array and one "values" array |
数组计数值() | Counts all the values of an array |
数组差异() | Compare arrays, and returns the differences (compare values only) |
数组差异() | Compare arrays, and returns the differences (compare keys and values) |
数组差异键() | Compare arrays, and returns the differences (compare keys only) |
数组_diff_uassoc() | Compare arrays, and returns the differences (compare keys and values, using a user-defined key comparison function) |
数组_diff_ukey() | Compare arrays, and returns the differences (compare keys only, using a user-defined key comparison function) |
数组填充() | Fills an array with values |
数组填充键() | Fills an array with values, specifying keys |
数组过滤器() | Filters the values of an array using a callback function |
数组翻转() | Flips/Exchanges all keys with their associated values in an array |
数组相交() | Compare arrays, and returns the matches (compare values only) |
数组相交() | Compare arrays and returns the matches (compare keys and values) |
数组相交键() | Compare arrays, and returns the matches (compare keys only) |
数组相交() | Compare arrays, and returns the matches (compare keys and values, using a user-defined key comparison function) |
数组相交_ukey() | Compare arrays, and returns the matches (compare keys only, using a user-defined key comparison function) |
数组键存在() | Checks if the specified key exists in the array |
数组键() | Returns all the keys of an array |
数组映射() | Sends each value of an array to a user-made function, which returns new values |
数组合并() | Merges one or more arrays into one array |
array_merge_recursive() | Merges one or more arrays into one array recursively |
array_multisort() | Sorts multiple or multi-dimensional arrays |
数组填充() | Inserts a specified number of items, with a specified value, to an array |
数组弹出() | Deletes the last element of an array |
数组乘积() | Calculates the product of the values in an array |
数组推送() | Inserts one or more elements to the end of an array |
数组随机数() | Returns one or more random keys from an array |
数组_reduce() | Returns an array as a string, using a user-defined function |
数组替换() | Replaces the values of the first array with the values from following arrays |
array_replace_recursive() | Replaces the values of the first array with the values from following arrays recursively |
array_reverse() | Returns an array in the reverse order |
数组搜索() | Searches an array for a given value and returns the key |
数组移位() | Removes the first element from an array, and returns the value of the removed element |
数组切片() | Returns selected parts of an array |
数组拼接() | Removes and replaces specified elements of an array |
数组总和() | Returns the sum of the values in an array |
数组_udiff() | Compare arrays, and returns the differences (compare values only, using a user-defined key comparison function) |
数组_udiff_assoc() | Compare arrays, and returns the differences (compare keys and values, using a built-in function to compare the keys and a user-defined function to compare the values) |
数组_udiff_uassoc() | Compare arrays, and returns the differences (compare keys and values, using two user-defined key comparison functions) |
数组_uintersect() | Compare arrays, and returns the matches (compare values only, using a user-defined key comparison function) |
数组uintersect_assoc() | Compare arrays, and returns the matches (compare keys and values, using a built-in function to compare the keys and a user-defined function to compare the values) |
数组_uintersect_uassoc() | Compare arrays, and returns the matches (compare keys and values, using two user-defined key comparison functions) |
数组唯一() | Removes duplicate values from an array |
数组取消移动() | Adds one or more elements to the beginning of an array |
数组值() | Returns all the values of an array |
数组遍历() | Applies a user function to every member of an array |
array_walk_recursive() | Applies a user function recursively to every member of an array |
arsort() | Sorts an associative array in descending order, according to the value |
排序() | Sorts an associative array in ascending order, according to the value |
袖珍的() | Create array containing variables and their values |
数数() | Returns the number of elements in an array |
当前的() | Returns the current element in an array |
每个() | Deprecated from PHP 7.2. Returns the current key and value pair from an array |
结尾() | Sets the internal pointer of an array to its last element |
提炼() | Imports variables into the current symbol table from an array |
数组中 | Checks if a specified value exists in an array |
钥匙() | Fetches a key from an array |
krsort() | Sorts an associative array in descending order, according to the key |
排序() | Sorts an associative array in ascending order, according to the key |
列表() | 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 |
下一个() | Advance the internal array pointer of an array |
pos() | Alias of 当前的() |
上一页() | Rewinds the internal array pointer |
范围() | Creates an array containing a range of elements |
重置() | Sets the internal pointer of an array to its first element |
rsort() | Sorts an indexed array in descending order |
洗牌() | Shuffles an array |
sizeof() | Alias of 数数() |
种类() | Sorts an indexed array in ascending order |
uasort() | Sorts an array by values using a user-defined comparison function |
uksort() | Sorts an array by keys using a user-defined comparison function |
usort() | Sorts an array using a user-defined comparison function |