1, positioning array:
- bool in_array (mixed needle,arrayhaystack[,bool strict]) Find the specified element; y input [, mixed search_value]) returns the key value Array composed of;
- bool array_key_exists(mixed key,array search) determines whether the key value is the specified key value;
-
array array_values ( array
- input) returns the element value in the array; 2, traverses the array: mixed key (array input) returns the key value of the current pointer element;
-
mixed reset (array
- input_array) Resets the pointer to the starting position of the array; array
- each (array input_array) Returns the array value at the current pointer position;
- mixed current (array input_array) Returns the array element value at the current pointer position; mixed end
- (array input_array) Returns the last element pointed by the current pointer;
-
mixed next (array input_array ) returns the array element at the next position of the current pointer; mixed prev (array
- input_array ) returns the array value at the previous position of the current pointer; 3 ,Add and delete array elements:
-
int array_push(array
- & array
- ,mixe var[, mixed...]) will increase the specified value to array End; mixed array_pop (array & array
- ) Returns the last element of the array and resets the array pointer; mixed array_shift( arraytarget_array) Returns the first element value of the array;
-
int array_unshift ( array &array
- , mixed var [,mixed ... ] )Add the specified element to the starting position array array_pad(array
- input,int pad_size,mixed pad_value) Increase the array to the specified length 4. Array sorting: bool sort/rsort (array &array
- [,int sort_flags]); ascending and descending order;
-
5, merging and splitting arrays: array array_combine
- (array
- keys,array values) merging of arrays; array array_merge(array
- array1[,arrayarray2[arrayarray...]]) Merge multiple arrays and return a new array; array array_slice (array
- array,int offset[,int length]) Starting from the specified position of the array, extract the specified length and save it to a new array; array explode(string separator,string string) Save the result after splitting;
- array implode(string glue,arraypieces) specifies the new characters for connecting elements through strings ;
- 5, create an array of the specified range:
- array range (mixe low ,mixed high[,number step]) creates an array of the specified range;
- array shuffle($array) pairs the elements in the specified array Perform random sorting;
- number array_sum (array input_array) Sum all elements;
The above has introduced the common array functions in PHP, including related content. I hope it will be helpful to friends who are interested in PHP tutorials.