Home > Backend Development > PHP Tutorial > Common array functions in php

Common array functions in php

WBOY
Release: 2016-07-29 09:12:03
Original
953 people have browsed it

1, positioning array:

  1. bool in_array (mixed needle,arrayhaystack[,bool strict]) Find the specified element; y input [, mixed search_value]) returns the key value Array composed of;
  2. bool array_key_exists(mixed key,array search) determines whether the key value is the specified key value;
  3. array array_values ( array
  4. 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;
  5. mixed reset (array
  6. input_array) Resets the pointer to the starting position of the array; array
  7. each (array input_array) Returns the array value at the current pointer position;
  8. mixed current (array input_array) Returns the array element value at the current pointer position; mixed end
  9. (array input_array) Returns the last element pointed by the current pointer;
  10. mixed next (array input_array ) returns the array element at the next position of the current pointer; mixed prev (array
  11. input_array ) returns the array value at the previous position of the current pointer; 3 ,Add and delete array elements:
  12. int array_push(array
  13. & array
  14. ,mixe var[, mixed...]) will increase the specified value to array End; mixed array_pop (array & array
  15. ) 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;
  16. int array_unshift ( array &array
  17. , mixed var [,mixed ... ] )Add the specified element to the starting position array array_pad(array
  18. input,int pad_size,mixed pad_value) Increase the array to the specified length 4. Array sorting: bool sort/rsort (array &array
  19. [,int sort_flags]); ascending and descending order;
  20. 5, merging and splitting arrays: array array_combine
  21. (array
  22. keys,array values) merging of arrays; array array_merge(array
  23. array1[,arrayarray2[arrayarray...]]) Merge multiple arrays and return a new array; array array_slice (array
  24. 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;
  25. array implode(string glue,arraypieces) specifies the new characters for connecting elements through strings ;
  26. 5, create an array of the specified range:
  27. array range (mixe low ,mixed high[,number step]) creates an array of the specified range;
  28. array shuffle($array) pairs the elements in the specified array Perform random sorting;
  29. 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.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template