Understanding array

An array stores multiple values in one single variable. To understand more about array Analyze the sample below.

Lets use array

In PHP, there are three types of arrays:

  • Indexed arrays – Arrays with a numeric index
  • Associative arrays – Arrays with named keys
  • Multidimensional arrays – Arrays containing one or more arrays (advance)

PHP Indexed Arrays

The index can be assigned automatically (index always starts at 0), like this:

or the index can be assigned manually:

The following example creates an indexed array named $cars, assigns three elements to it, and then prints a text containing the array values:

PHP Associative Arrays

There are two ways to create an associative array:


It can be done by this.

To learn more about array you can visit w3schools or google they can give you more explanation on array and types of array.
Here a quick peek 

PHP Multidimensional Arrays

PHP understands multidimensional arrays that are two, three, four, five, or more levels deep. However, arrays more than three levels deep are hard to manage for most people.

Now the two-dimensional $cars array contains four arrays, and it has two indices: row and column.

To get access to the elements of the $cars array we must point to the two indices (row and column):

Here’s a quick peek