Function |
Role |
Usage |
Unset () |
Destroys the specified variable |
Unset ($arr)/unset ($arr [n]) |
Array_values () |
Gets all the values in the array and re-establishes the numeric subscript |
Array_values ($arr) |
Array_keys () |
Gets all the key values in the array |
Array_keys ($arr) |
Is_array () |
Determines whether an array |
Is_array ($arr) |
In_array () |
Determines whether an array $arr contains an element $str |
In_array ($str, $arr) |
Count () |
Statistic array length/statistic multidimensional array length |
Count ($arr)/count ($arr, 1) |
Range () |
Create an array of 1-9 |
Rang (1,9), range (A-Z) |
Array_merge () |
Concatenate multiple arrays into an array |
Array_merge ($arr, $brr ...) |
Array_rand () |
Randomly extracts n cells in the array, returns the key value, becomes the new array |
Array_rand ($arr, N) |
Shuffle () |
Scrambled Array Order |
Shuffle ($arr) |
each () |
Returns the key/value pair of the current element in the array and automatically moves the array pointer forward one step |
each ($arr) |
List (): Language structure |
Assign the values in the array to some variables |
List ($a, $b, $c) = $arr |
Array_unshift () |
Insert one or more cells at the beginning of an array |
Array_unshift ($arr, $v 1, $v 2 ...) |
Array_push () |
Inserts one or more cells at the end of the array |
Array_push ($arr, $v 1, $v 2 ...) |
Array_pop () |
The last element of the array is removed and returned |
Array_pop ($arr) |
Array_key_exist () |
Determine if the key $k exists in the array |
Array_key_exist ($k, $arr) |
Array_search () |
Searches the array for the given value $v, and returns the corresponding key name if successful |
Array_search ($v, $arr) |
Array_flip () |
Swap the keys and values of an array |
Array_flip ($arr) |
Array_count_values () |
Count the number of occurrences of all values in the array |
Array_count_values ($arr) |
Array_unique () |
Move duplicate values in an array |
Array_unique ($arr) |
Sort () |
Sort the array in ascending order of the size of the values |
Sort ($arr) |
Asort () |
Arranges the array in ascending order of value and keeps the index relationship |
Asort ($arr) |
Rsort () |
Arranges the array in descending order of the size of the values, rearranging the indexes |
Rsort ($arr) |
Arsort |
Sorts the array in descending order of the size of the values, keeping the index |
Arsort ($arr) |
Natsort () |
Natural sorting (in line with People's Daily habits) |
Natsort ($arr) |
Ksort () |
Arranges arrays in descending order of key size, preserving the association of key names to data |
Ksort ($arr) |
Krsort () |
Arranges arrays in descending order of key size, preserving the association of key names to data |
Krsort ($arr) |
Array_sum () |
Sum all the values in an array |
Array_sum ($arr) |
Key () |
Gets the position of the traversal pointer in the array (key) |
Key ($arr) |
Current () |
Get the value of the position where the pointer is |
Current ($arr) |
Next () |
Moves the pointer back one position in the array |
Next ($arr) |
Prev () |
Move the pointer in the array forward one position |
Prev ($arr) |
Reset () |
Resets the position of the pointer in the array (pointing to the first position) |
Reset ($arr) |
End () |
Move the pointer in the array to the last position |
End ($arr) |