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

array 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

void extract(array var_array, int extract_type [, string prefix])

Import variables into a symbol table from an array

mixed key(array array_arg)

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

int krsort(array array_arg)

Sort an array in reverse by key

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

array range(int low, int high)

Create an array containing the range of integers from low to high (inclusive)

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 shuffle(array array_arg)

Randomly shuffle the contents of an array

int sizeof(mixed var)

An alias for count( )

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

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.12.155.100