• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 16. PHP > Array Functions

16.13. Array Functions

PHP supports arrays that are indexed both by integers and by arbitrary strings—known as associative arrays. Internally, PHP does not distinguish between associative arrays and integer-indexed arrays, as arrays are implemented as hash tables. Here are the array functions supported by PHP:


array array(...)

Create an array that contains all of the specified arguments


int array_walk(array array_arg, string function)

Apply a function to every member of an array


int arsort(array array_arg)

Sort an array in reverse order and maintain index association


int asort(array array_arg)

Sort an array and maintain index association


int count(mixed var)

Count the number of elements in a variable (usually an array)


mixed current(array array_arg)

Return the element currently pointed to by the internal array pointer


mixed each(array array_arg)

Return the next key/value pair from an array


mixed end(array array_arg)

Advance the array's internal pointer to the last element and return the value of that element


mixed key(array array_arg)

Return the key of the element currently pointed to by the internal array pointer


int ksort(array array_arg)

Sort an array by key


mixed max(mixed arg1 [, mixed arg2 [, ...]])

Return the highest value in an array or a series of arguments


mixed min(mixed arg1 [, mixed arg2 [, ...]])

Return the lowest value in an array or a series of arguments


mixed next(array array_arg)

Move the array's internal pointer to the next element and return the value of that element


mixed pos(array array_arg)

An alias for current


mixed prev(array array_arg)

Move the array's internal pointer to the previous element and return the value of that element


mixed reset(array array_arg)

Set the array's internal pointer to the first element and return the value of that element


int rsort(array array_arg)

Sort an array in reverse order


int sort(array array_arg)

Sort an array


int uasort(array array_arg, string cmp_function)

Sort an array with a user-defined comparison function and maintain index association


int uksort(array array_arg, string cmp_function)

Sort an array by keys using a user-defined comparison function


int usort(array array_arg, string cmp_function)

Sort an array using a user-defined comparison function


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint