Quick Overview of Common PHP Array Functions

Array is very important section of PHP language.PHP supports Simple and multi-dimensional arrays .In this tutorial I will let you know best array PHP fucntions.These functions allows you to interact and manipulate arrays in various ways.

Checkout other tutorial of PHP,

Arrays are essential for storing, managing and operating on sets of variables.There are specific database handling functions for populating arrays from database queries.

array_merge() — This function use to merges the elements of one or more arrays together so that the values of one are appended to the end of the previous one. It returns the resulting array.

array_combine() — This function creates an array by using one array for keys and another for its values.
Returns the combined array, FALSE if the number of elements for each array isn’t equal.

range() — This function create an array containing a range of elements.

is_array() — This function used to check whether a variable is an array or not.

in_array() — This function used to check if a value exists in an array.

array_search() — This function searches the array for a given value and returns the corresponding key if successful.Returns the key for needle if it is found in the array, FALSE otherwise.

array_shift() — array_shift function is used to remove an element of the beginning of array.This function is used to remove an element from array in php.You can add an element using array_unshift() function.

array_unshift() — This function used to prepend one or more elements to the beginning of an array.

Next() — This function used to advance the internal array pointer of an array.

array_push() — This function used to push one or more elements onto the end of array.

array_pop() — This function used to pop the element off the end of array.

asort() — Sort an array and maintain index association.
sort() — Sort an array.
arsort() — Sort an array in reverse order and maintain index association.
ksort() — Sort an array by key.