Array Manipulation Functions

Contact Us or call 1-877-932-8228
Array Manipulation Functions

Array Manipulation Functions

The following table shows some of the more common array manipulation functions.

For a complete list of array functions, see http://www.php.net/array

Useful Array Functions
Function Explanation
sort() Sorts an array alphabetically. Elements will be assigned to new index numbers.
asort() Sorts associative arrays alphabetically by value. The index association remains intact.
ksort() Sorts associative arrays alphabetically by key. The index association remains intact.
rsort() Reverse sorts an array alphabetically. Elements will be assigned to new index numbers.
arsort() Reverse sorts associative arrays alphabetically by value. The index association remains intact.
krsort() Reverse sorts associative arrays alphabetically by key. The index association remains intact.
shuffle() Randomly sorts the array. For the order to be sorted differently each time, the random number generator needs to be seeded with rsand().
array_reverse() Returns an array with the elements in reverse order.
array_walk() Applies a user function to every element of an array.
count() Returns the number of elements in an array.
explode() Converts a string to an array by splitting it on a specified separator.
is_array() Takes one parameter and returns true or false depending on whether the parameter passed is an array.
array_keys() Returns all the keys of an associative array as an array.
array_key_exists() Checks to see if a specified key exists in an array.
Next