The array is a variable that holds more than one value within a single variable. Generally, the element of the array will be of the same data type.
Associative array:It is also an array in which each key is associated with a value.
Multidimensional array:It is an array containing more than one array.
There are two ways to represent PHP arrays. These are:
Let us see the associated example.
An indexed or numeric array is very useful for storing each array element with a numeric index. By default array index starts from
0 indexes and the last element index number is
To create an indexed array, pass multiple values inside the PHP
array() function and separate each value with a comma
Remember: Indexes start from 0, not 1.
Index array element can be access through:
PHP associative array has named keys that contain the values.
Creating an associative array using two ways:
1:An associative array can be created using the
array() function or