Common PHP array functions

  1. array_unshift inserted at the beginning of an array of one or more values
    Example: array_unshift ([2,3.4], 1 ) Results: [1, 2, 3, 4]
  2. the insertion end of the array array_push
    Example: array_push ([1, 2, 3], 4]) Results: [1, 2, 3, 4]
  3. array_diff - difference set computing arrays 
  4. Remove the last element in the array array_pop
    Example: array_pop ([1,2,3,4]) Results: [1, 2, 3]
  5. The combined arrays array_merge two
    examples: array_merge ([1, 3], [2, 4]) Results: [1, 2, 3, 4]
  6. has a value search array array_search
    Example: array_search ([1, 3] , 3) Results: key 1 returns an array of values
  7. in_array check whether there is a value in the array
    Example: in_array (1, [1, 2, 3]) Results: true
  8. array_unique remove duplicate values in the array of
    sample: array_unique ([1,3,3,4]) Results: [1, 3, 4]
  9. implode array connector
    Example: implode ( ':', [ 1, 2, 3, 4]) Results: 1: 2: 3: 4
  10. sort (): Key value ascending order
    rsort (): Key value decommitment
    ksort (): Sort associative array keys in ascending order, sorting the results of retained association key
  11. count () statistics

 

Guess you like

Origin www.cnblogs.com/renluyang/p/11981948.html