In this tutorial, I am going to show you how the arrays in PHP work.
Numeric Arrays
There are two ways to write numeric arrays. You can use the array() function and write the elements one by one. Each element will start from index 0.
In second method, you can print the array element by specifically pointing element to the number in the array.
Associative Array
Think of associative array as key value pairs in the array. You are going to specify the value for each key. It can be numeric or the string. Make sure not to use the quotes while printing these array as it could cause error.
Multidimensional Array
In this type of array, any array can contain one more array within itself. Make sure not to get confused with the amount of array inside the arrays.
Take a look at this code for each array type.