PHP array
PHP
PHP arrays are powerful tools for storing multiple values within a single variable . This capability allows developers to organize data efficiently, accessing elements through indexes, which can be either numeric or string-based keys. An array is essentially a collection of variables, each referred to as an element. These elements can be directly retrieved using their specific indexes, simplifying data manipulation and retrieval in PHP programming.
Array Creation and Initialization
Displaying, Checking and counting elements
Function Details
array_count_values calculate the frequency of occurrence of elements inside a array
Displaying elements Listing all elements of the array
array_is_list() checks if an array is a list
is_array To check the variable is array or not
array_size() How many elements are present inside the array? We can find out by count or sizeof() function.
array_max() Maximum minimum value present inside array
array_rand Randomly collecting elements of an array
array_sum Total value or sum of the elements present inside an array
array_shuffle randomizes the order of the elements of an array
Array Modification
Array Sorting
Function Details
Sorting Sorting all elements of an array by sort command
array_multisort() Sorting Multiple Arrays
usort() Sort the elements using a user-defined function
Array Searching
Array Filtering and Extraction
Array Merging and Combining
Array Intersection
Array Difference
Function Details
array_diff_uassoc Resultant third array by differentiating values and (keys through callback function)
array_diff_ukey Resultant third array by comparing keys through callback function
array_udiff Resultant third array by comparing values through callback function
array_diff_key We can generate a resultant third array by differentiating two arrays by considering keys only
Array Adding & Removing Elements
Array Traversing & Navigation
Function Details
Current Get the current element of the array
Next Move to the next element
Previous Move to the previous element
End Move to the last element
Reset Move to the first element
Array Form Handling and Session Management
Function Details
Array checkbox Getting checkbox value using array
http_build_query generate query string using elements to pass through URL
Session array create a session array and carry same data across the pages.
function Passing and returning array from a function
Cookies Cookies array adding and deleting elements
← Subscribe to our YouTube Channel here
This article is written by plus2net.com team.
https://www.plus2net.com
plus2net.com