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 ...
Get PHP Pocket Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.