F.2. Arrays

FunctionReturnsDescription
krsort(array array_arg [, int sort_flags])
boolSorts an array by key value in reverse order.
ksort(array array_arg [, int sort_flags])
boolSorts an array by key.
count(mixed var [, int mode])
intCounts the number of elements in a variable (usually an array).
natsort(array array_arg)
voidSorts an array using natural sort.
natcasesort(array array_arg)
voidSorts an array using case-insensitive natural sort.
asort(array array_arg [, int sort_flags])
boolSorts an array and maintains index association.
arsort(array array_arg [, int sort_flags])
boolSorts an array in reverse order and maintains index association.
sort(array array_arg [, int sort_flags])
boolSorts an array.
rsort(array array_arg [, int sort_flags])
boolSorts an array in reverse order.
usort(array array_arg, string cmp_function)
boolSorts an array by values using a user-defined comparison function.
uasort(array array_arg, string cmp_function)
boolSorts an array with a user-defined comparison function and maintains index association.
uksort(array array_arg, string cmp_function)
boolSorts an array by keys using a user-defined comparison function.
end(array array_arg)
mixedAdvances array argument's internal pointer to the last element and returns it.
prev(array array_arg)
mixedMoves array argument's internal pointer to the previous element and returns it.
next(array array_arg)
mixedMoves array argument's internal pointer to the next element and returns it.
reset(array array_arg)
mixed ...

Get Web Standards Programmer's Reference: HTML, CSS, JavaScript®, Perl, Python®, and PHP 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.