PHP arrayPHP array are useful to store multiple data using a single variable. Using index of the PHP array we can access the stored variables. Indexes to an array element can either a number or a string. An array is a list variables. Each item in an array is commonly known as element of the array and can be accessed directly via its index.
In PHP there are different ways to create or declare an array. We can assign keys to each element of the array.
We can generate a resultant third array by differentiating two arrays
We can calculate the frequency of occurrence of elements inside a array.
How many elements are present inside the array? We can find out by count or sizeof() function.
Using max and min function we can get maximum and minimum value of an array in PHP.
We can the array of keys from a array by using array_keys function in PHP.
WE can apply native functions or user defined function to each elements of array by using using array_map.
We can add elements to an existing array by using array_push
We can get total value or sum of the elements present inside an array
Check the presence of an element inside an array. Returns True of False
Randomly collecting elements of an array
We can get a set of unique value from an array.
We can split a string and create a array by using all words.
We can create a session array and carry same data across the pages.
By using unset command we can delete elements of an array
Sorting all elements of an array by sort command
Rsort command can be used to sort the elements in reverse order
By using asort we can sort the elements and by maintaining the associated index of each element.
We can reverse sort the elements of array and maintain the associated key with elements.
We can sort the array on key and maintain the association with the elements.
Key can be sorted in reverse order and the association is maintained.
We can use one user defined function and sort the elements.
We can display all elements of the array by different methods.
Creating new array with filter ( callback ) function
Passing user defined function to each element of an array
|Click here for More on PHP Array functions|