KEMBAR78
List of all php array functions | DOCX
List of All PHP Array Functions


      Function                       Description                              Syntax

                                                                 array array_change_key_case ( array
array_change_key_case       Changes all keys in an array
                                                                 $input [, int $case = CASE_LOWER ] )

                                                                  array array_chunk ( array $input , int
     array_chunk              Split an array into chunks
                                                                 $size [, bool $preserve_keys = false ] )

                        Creates an array by using one array       array array_combine ( array $keys ,
    array_combine
                         for keys and another for its values                array $values )

                                                                    array array_count_values ( array
 array_count_values       Counts all the values of an array
                                                                                $input )
                         Computes the difference of arrays       array array_diff_assoc ( array $array1
   array_diff_assoc
                           with additional index check                , array $array2 [, array $... ] )

                         Computes the difference of arrays        array array_diff_key ( array $array1 ,
    array_diff_key
                           using keys for comparison                   array $array2 [, array $... ] )

                         Computes the difference of arrays
                                                                 array array_diff_uassoc ( array
                        with additional index check which is
  array_diff_uassoc                                            $array1 , array $array2 [, array $... ],
                            performed by a user supplied
                                                                  callback $key_compare_func )
                                  callback function
                         Computes the difference of arrays array array_diff_ukey ( array $array1 ,
   array_diff_ukey      using a callback function on the keys array $array2 [, array $ ... ], callback
                                   for comparison                      $key_compare_func )
                                                              array array_diff ( array $array1 , array
      array_diff         Computes the difference of arrays
                                                                       $array2 [, array $ ... ] )
                         Fill an array with values, specifying    array array_fill_keys ( array $keys ,
    array_fill_keys
                                          keys                              mixed $value )
                                                                  array array_fill ( int $start_index , int
       array_fill              Fill an array with values
                                                                         $num , mixed $value )

                         Filters elements of an array using a       array array_filter ( array $input [,
     array_filter
                                   callback function                      callback $callback ] )

                            Exchanges all keys with their
      array_flip                                                     array array_flip ( array $trans )
                            associated values in an array

                        Computes the intersection of arrays array array_intersect_assoc ( array
array_intersect_assoc
                           with additional index check      $array1 , array $array2 [, array $ ... ] )

                        Computes the intersection of arrays   array array_intersect_key ( array
 array_intersect_key
                           using keys for comparison        $array1 , array $array2 [, array $ ... ] )
Function                        Description                             Syntax


                          Computes the intersection of arrays
                                                                   array array_intersect_uassoc ( array
                             with additional index check,
array_intersect_uassoc                                             $array1 , array $array2 [, array $ ... ],
                           compares indexes by a callback
                                                                      callback $key_compare_func )
                                       function



                           Computes the intersection of arrays   array array_intersect_ukey ( array
 array_intersect_ukey     using a callback function on the keys $array1 , array $array2 [, array $... ],
                                     for comparison                callback $key_compare_func )
                                                                  array array_intersect ( array $array1 ,
    array_intersect       Computes the intersection of arrays
                                                                       array $array2 [, array $ ... ] )

                            Checks if the given key or index       bool array_key_exists ( mixed $key ,
   array_key_exists
                                  exists in the array                        array $search )

                                                                    array array_keys ( array $input [,
                          Return all the keys or a subset of the
      array_keys                                                 mixed $search_value [, bool $strict =
                                     keys of an array
                                                                                 false ]] )
                          Applies the callback to the elements array array_map ( callback $callback ,
      array_map
                                   of the given arrays                  array $arr1 [, array $... ] )
                                                                  array array_merge_recursive ( array
array_merge_recursive     Merge two or more arrays recursively
                                                                          $array1 [, array $... ] )
                                                                  array array_merge ( array $array1 [,
     array_merge               Merge one or more arrays
                                                                               array $... ] )
                                                                  bool array_multisort ( array &$arr [,
                           Sort multiple or multi-dimensional
    array_multisort                                              mixed $arg = SORT_ASC [, mixed $arg
                                          arrays
                                                                  = SORT_REGULAR [, mixed $... ]]] )
                          Pad array to the specified length with array array_pad ( array $input , int
      array_pad
                                          a value                    $pad_size , mixed $pad_value )
      array_pop           Pop the element off the end of array      mixed array_pop ( array &$array )
                          Calculate the product of values in an
    array_product                                                 number array_product ( array $array )
                                            array
                          Push one or more elements onto the      int array_push ( array &$array , mixed
      array_push
                                        end of array                        $var [, mixed $... ] )
                          Pick one or more random entries out      mixed array_rand ( array $input [, int
      array_rand
                                         of an array                          $num_req = 1 ] )
                             Iteratively reduce the array to a      mixed array_reduce ( array $input ,
     array_reduce              single value using a callback       callback $function [, mixed $initial =
                                          function                                NULL ] )
                                                                   array array_replace_recursive ( array
                            Replaces elements from passed
array_replace_recursive                                           &$array , array &$array1 [, array &$... ]
                          arrays into the first array recursively
                                                                                      )
Function                     Description                            Syntax


                      Replaces elements from passed         array array_replace ( array &$array ,
  array_replace
                         arrays into the first array           array &$array1 [, array &$... ] )



                      Return an array with elements in       array array_reverse ( array $array [,
 array_reverse
                               reverse order                   bool $preserve_keys = false ] )


                    Searches the array for a given value mixed array_search ( mixed $needle ,
  array_search      and returns the corresponding key if array $haystack [, bool $strict = false ]
                                 successful                                 )



                    Shift an element off the beginning of
   array_shift                                               mixed array_shift ( array &$array )
                                   array


                                                             array array_slice ( array $array , int
   array_slice           Extract a slice of the array            $offset [, int $length [, bool
                                                                 $preserve_keys = false ]] )


                                                            array array_splice ( array &$input , int
                     Remove a portion of the array and
  array_splice                                                 $offset [, int $length = 0 [, mixed
                       replace it with something else
                                                                       $replacement ]] )


                      Calculate the sum of values in an
   array_sum                                                 number array_sum ( array $array )
                                    array




                     Computes the difference of arrays     array array_udiff_assoc ( array
array_udiff_assoc      with additional index check,      $array1 , array $array2 [, array $ ... ],
                    compares data by a callback function   callback $data_compare_func )
Function                        Description                            Syntax




                           Computes the difference of arrays        array array_udiff_uassoc ( array
                              with additional index check,        $array1 , array $array2 [, array $ ... ],
  array_udiff_uassoc
                            compares data and indexes by a          callback $data_compare_func ,
                                   callback function                 callback $key_compare_func )




                          Computes the difference of arrays by  array array_udiff ( array $array1 ,
      array_udiff          using a callback function for data  array $array2 [, array $ ... ], callback
                                      comparison                      $data_compare_func )




                           Computes the intersection of arrays array array_uintersect_assoc ( array
array_uintersect_assoc        with additional index check,     $array1 , array $array2 [, array $ ... ],
                          compares data by a callback function    callback $data_compare_func )




                          Computes the intersection of arrays array array_uintersect_uassoc ( array
                             with additional index check,      $array1 , array $array2 [, array $ ... ],
array_uintersect_uassoc
                           compares data and indexes by a        callback $data_compare_func ,
                                  callback functions              callback $key_compare_func )
Function                       Description                           Syntax



                                                            array array_uintersect ( array $array1 ,
                       Computes the intersection of arrays,
  array_uintersect                                           array $array2 [, array $ ... ], callback
                       compares data by a callback function
                                                                    $data_compare_func )




                        Removes duplicate values from an array array_unique ( array $array [, int
   array_unique
                                     array                  $sort_flags = SORT_STRING ] )




                       Prepend one or more elements to the      int array_unshift ( array &$array ,
   array_unshift
                              beginning of an array                 mixed $var [, mixed $... ] )



   array_values          Return all the values of an array      array array_values ( array $input )




                                                              bool array_walk_recursive ( array
                       Apply a user function recursively to
array_walk_recursive                                        &$input , callback $funcname [, mixed
                           every member of an array
                                                                          $userdata ] )




                                                                bool array_walk ( array &$array ,
                          Apply a user function to every
    array_walk                                                    callback $funcname [, mixed
                               member of an array
                                                                          $userdata ] )




       array                      Create an array                   array array ([ mixed $... ] )



                        Sort an array in reverse order and       bool arsort ( array &$array [, int
       arsort
                           maintain index association           $sort_flags = SORT_REGULAR ] )
Function                Description                             Syntax


             Sort an array and maintain index          bool asort ( array &$array [, int
 asort
                        association                   $sort_flags = SORT_REGULAR ] )




           Create array containing variables and      array compact ( mixed $varname [,
compact
                        their values                            mixed $... ] )




             Count all elements in an array, or      int count ( mixed $var [, int $mode =
 count
                 properties in an object                     COUNT_NORMAL ] )




             Return the current element in an
current                                                 mixed current ( array &$array )
                          array




           Return the current key and value pair
 each      from an array and advance the array            array each ( array &$array )
                          cursor




           Set the internal pointer of an array to
  end                                                     mixed end ( array &$array )
                       its last element




                                                      int extract ( array &$var_array [, int
             Import variables into the current
extract                                              $extract_type = EXTR_OVERWRITE [,
               symbol table from an array
                                                                string $prefix ]] )
Function                 Description                            Syntax




                                                      bool in_array ( mixed $needle , array
 in_array     Checks if a value exists in an array
                                                      $haystack [, bool $strict = FALSE ] )




   key             Fetch a key from an array              mixed key ( array &$array )



                                                        bool krsort ( array &$array [, int
  krsort      Sort an array by key in reverse order
                                                       $sort_flags = SORT_REGULAR ] )




                                                        bool ksort ( array &$array [, int
   ksort              Sort an array by key
                                                       $sort_flags = SORT_REGULAR ] )




              Assign variables as if they were an     array list ( mixed $varname [, mixed
    list
                            array                                      $... ] )




                   Sort an array using a case
natcasesort                                            bool natcasesort ( array &$array )
              insensitive "natural order" algorithm




              Sort an array using a "natural order"
  natsort                                                bool natsort ( array &$array )
                            algorithm




              Advance the internal array pointer of
   next                                                   mixed next ( array &$array )
                           an array
Function                Description                           Syntax

  pos                Alias of current()


  prev       Rewind the internal array pointer         mixed prev ( array &$array )



           Create an array containing a range of     array range ( mixed $start , mixed
 range
                         elements                       $limit [, number $step = 1 ] )


           Set the internal pointer of an array to
 reset                                                 mixed reset ( array &$array )
                      its first element
                                                      bool rsort ( array &$array [, int
 rsort        Sort an array in reverse order
                                                     $sort_flags = SORT_REGULAR ] )
shuffle               Shuffle an array                 bool shuffle ( array &$array )
 sizeof               Alias of count()
                                                       bool sort ( array &$array [, int
  sort                 Sort an array
                                                     $sort_flags = SORT_REGULAR ] )
             Sort an array with a user-defined
                                                 bool uasort ( array &$array , callback
 uasort     comparison function and maintain
                                                           $cmp_function )
                     index association
            Sort an array by keys using a user- bool uksort ( array &$array , callback
 uksort
               defined comparison function                 $cmp_function )
           Sort an array by values using a user- bool usort ( array &$array , callback
 usort
               defined comparison function                 $cmp_function )

List of all php array functions

  • 1.
    List of AllPHP Array Functions Function Description Syntax array array_change_key_case ( array array_change_key_case Changes all keys in an array $input [, int $case = CASE_LOWER ] ) array array_chunk ( array $input , int array_chunk Split an array into chunks $size [, bool $preserve_keys = false ] ) Creates an array by using one array array array_combine ( array $keys , array_combine for keys and another for its values array $values ) array array_count_values ( array array_count_values Counts all the values of an array $input ) Computes the difference of arrays array array_diff_assoc ( array $array1 array_diff_assoc with additional index check , array $array2 [, array $... ] ) Computes the difference of arrays array array_diff_key ( array $array1 , array_diff_key using keys for comparison array $array2 [, array $... ] ) Computes the difference of arrays array array_diff_uassoc ( array with additional index check which is array_diff_uassoc $array1 , array $array2 [, array $... ], performed by a user supplied callback $key_compare_func ) callback function Computes the difference of arrays array array_diff_ukey ( array $array1 , array_diff_ukey using a callback function on the keys array $array2 [, array $ ... ], callback for comparison $key_compare_func ) array array_diff ( array $array1 , array array_diff Computes the difference of arrays $array2 [, array $ ... ] ) Fill an array with values, specifying array array_fill_keys ( array $keys , array_fill_keys keys mixed $value ) array array_fill ( int $start_index , int array_fill Fill an array with values $num , mixed $value ) Filters elements of an array using a array array_filter ( array $input [, array_filter callback function callback $callback ] ) Exchanges all keys with their array_flip array array_flip ( array $trans ) associated values in an array Computes the intersection of arrays array array_intersect_assoc ( array array_intersect_assoc with additional index check $array1 , array $array2 [, array $ ... ] ) Computes the intersection of arrays array array_intersect_key ( array array_intersect_key using keys for comparison $array1 , array $array2 [, array $ ... ] )
  • 2.
    Function Description Syntax Computes the intersection of arrays array array_intersect_uassoc ( array with additional index check, array_intersect_uassoc $array1 , array $array2 [, array $ ... ], compares indexes by a callback callback $key_compare_func ) function Computes the intersection of arrays array array_intersect_ukey ( array array_intersect_ukey using a callback function on the keys $array1 , array $array2 [, array $... ], for comparison callback $key_compare_func ) array array_intersect ( array $array1 , array_intersect Computes the intersection of arrays array $array2 [, array $ ... ] ) Checks if the given key or index bool array_key_exists ( mixed $key , array_key_exists exists in the array array $search ) array array_keys ( array $input [, Return all the keys or a subset of the array_keys mixed $search_value [, bool $strict = keys of an array false ]] ) Applies the callback to the elements array array_map ( callback $callback , array_map of the given arrays array $arr1 [, array $... ] ) array array_merge_recursive ( array array_merge_recursive Merge two or more arrays recursively $array1 [, array $... ] ) array array_merge ( array $array1 [, array_merge Merge one or more arrays array $... ] ) bool array_multisort ( array &$arr [, Sort multiple or multi-dimensional array_multisort mixed $arg = SORT_ASC [, mixed $arg arrays = SORT_REGULAR [, mixed $... ]]] ) Pad array to the specified length with array array_pad ( array $input , int array_pad a value $pad_size , mixed $pad_value ) array_pop Pop the element off the end of array mixed array_pop ( array &$array ) Calculate the product of values in an array_product number array_product ( array $array ) array Push one or more elements onto the int array_push ( array &$array , mixed array_push end of array $var [, mixed $... ] ) Pick one or more random entries out mixed array_rand ( array $input [, int array_rand of an array $num_req = 1 ] ) Iteratively reduce the array to a mixed array_reduce ( array $input , array_reduce single value using a callback callback $function [, mixed $initial = function NULL ] ) array array_replace_recursive ( array Replaces elements from passed array_replace_recursive &$array , array &$array1 [, array &$... ] arrays into the first array recursively )
  • 3.
    Function Description Syntax Replaces elements from passed array array_replace ( array &$array , array_replace arrays into the first array array &$array1 [, array &$... ] ) Return an array with elements in array array_reverse ( array $array [, array_reverse reverse order bool $preserve_keys = false ] ) Searches the array for a given value mixed array_search ( mixed $needle , array_search and returns the corresponding key if array $haystack [, bool $strict = false ] successful ) Shift an element off the beginning of array_shift mixed array_shift ( array &$array ) array array array_slice ( array $array , int array_slice Extract a slice of the array $offset [, int $length [, bool $preserve_keys = false ]] ) array array_splice ( array &$input , int Remove a portion of the array and array_splice $offset [, int $length = 0 [, mixed replace it with something else $replacement ]] ) Calculate the sum of values in an array_sum number array_sum ( array $array ) array Computes the difference of arrays array array_udiff_assoc ( array array_udiff_assoc with additional index check, $array1 , array $array2 [, array $ ... ], compares data by a callback function callback $data_compare_func )
  • 4.
    Function Description Syntax Computes the difference of arrays array array_udiff_uassoc ( array with additional index check, $array1 , array $array2 [, array $ ... ], array_udiff_uassoc compares data and indexes by a callback $data_compare_func , callback function callback $key_compare_func ) Computes the difference of arrays by array array_udiff ( array $array1 , array_udiff using a callback function for data array $array2 [, array $ ... ], callback comparison $data_compare_func ) Computes the intersection of arrays array array_uintersect_assoc ( array array_uintersect_assoc with additional index check, $array1 , array $array2 [, array $ ... ], compares data by a callback function callback $data_compare_func ) Computes the intersection of arrays array array_uintersect_uassoc ( array with additional index check, $array1 , array $array2 [, array $ ... ], array_uintersect_uassoc compares data and indexes by a callback $data_compare_func , callback functions callback $key_compare_func )
  • 5.
    Function Description Syntax array array_uintersect ( array $array1 , Computes the intersection of arrays, array_uintersect array $array2 [, array $ ... ], callback compares data by a callback function $data_compare_func ) Removes duplicate values from an array array_unique ( array $array [, int array_unique array $sort_flags = SORT_STRING ] ) Prepend one or more elements to the int array_unshift ( array &$array , array_unshift beginning of an array mixed $var [, mixed $... ] ) array_values Return all the values of an array array array_values ( array $input ) bool array_walk_recursive ( array Apply a user function recursively to array_walk_recursive &$input , callback $funcname [, mixed every member of an array $userdata ] ) bool array_walk ( array &$array , Apply a user function to every array_walk callback $funcname [, mixed member of an array $userdata ] ) array Create an array array array ([ mixed $... ] ) Sort an array in reverse order and bool arsort ( array &$array [, int arsort maintain index association $sort_flags = SORT_REGULAR ] )
  • 6.
    Function Description Syntax Sort an array and maintain index bool asort ( array &$array [, int asort association $sort_flags = SORT_REGULAR ] ) Create array containing variables and array compact ( mixed $varname [, compact their values mixed $... ] ) Count all elements in an array, or int count ( mixed $var [, int $mode = count properties in an object COUNT_NORMAL ] ) Return the current element in an current mixed current ( array &$array ) array Return the current key and value pair each from an array and advance the array array each ( array &$array ) cursor Set the internal pointer of an array to end mixed end ( array &$array ) its last element int extract ( array &$var_array [, int Import variables into the current extract $extract_type = EXTR_OVERWRITE [, symbol table from an array string $prefix ]] )
  • 7.
    Function Description Syntax bool in_array ( mixed $needle , array in_array Checks if a value exists in an array $haystack [, bool $strict = FALSE ] ) key Fetch a key from an array mixed key ( array &$array ) bool krsort ( array &$array [, int krsort Sort an array by key in reverse order $sort_flags = SORT_REGULAR ] ) bool ksort ( array &$array [, int ksort Sort an array by key $sort_flags = SORT_REGULAR ] ) Assign variables as if they were an array list ( mixed $varname [, mixed list array $... ] ) Sort an array using a case natcasesort bool natcasesort ( array &$array ) insensitive "natural order" algorithm Sort an array using a "natural order" natsort bool natsort ( array &$array ) algorithm Advance the internal array pointer of next mixed next ( array &$array ) an array
  • 8.
    Function Description Syntax pos Alias of current() prev Rewind the internal array pointer mixed prev ( array &$array ) Create an array containing a range of array range ( mixed $start , mixed range elements $limit [, number $step = 1 ] ) Set the internal pointer of an array to reset mixed reset ( array &$array ) its first element bool rsort ( array &$array [, int rsort Sort an array in reverse order $sort_flags = SORT_REGULAR ] ) shuffle Shuffle an array bool shuffle ( array &$array ) sizeof Alias of count() bool sort ( array &$array [, int sort Sort an array $sort_flags = SORT_REGULAR ] ) Sort an array with a user-defined bool uasort ( array &$array , callback uasort comparison function and maintain $cmp_function ) index association Sort an array by keys using a user- bool uksort ( array &$array , callback uksort defined comparison function $cmp_function ) Sort an array by values using a user- bool usort ( array &$array , callback usort defined comparison function $cmp_function )