In the given tutorial you will learn how to define and work with arrays and php array functions. Arrays a generally a container which can hold multiple values, unlike a variable where we assign a single value to a single variable. In arrays we can define the limit of index.
Step 1: Structure of an array functions
For array functions php, let’s first learn about an array.An array is a data structure that can store one or more values in a single attribute. If a person wants to save multiple values, he will have to make multiple variables to save those multiple values. This is a time consuming and memory wasting approach. A better approach would be to make a single variable and save all the multiple values in this single variable. An array can store multiple values.
![Demonstration of the structure of an array Demonstration of the structure of an array](https://howtech.tv/wp-content/images/001832/1.jpg)
Step 2: Kinds of arrays
In PHP, there are types of arrays:
• Numeric Arrays
• Associative Arrays
• Multidimensional Arrays
![Types of arrays Types of arrays](https://howtech.tv/wp-content/images/001832/2.jpg)
Step 3: Giving values to a numeric array
In php array functions, Numeric Arrays have numeric indexes and thus can be accessed numericaly in a sequence easily.
![Assigning values to a numeric array Assigning values to a numeric array](https://howtech.tv/wp-content/images/001832/3.jpg)
Step 4: Giving values to an associative array
Associative arrays have a unique ID associated with them through which they can be accessed.
![Assigning values to an associative array Assigning values to an associative array](https://howtech.tv/wp-content/images/001832/4.jpg)
Step 5: Giving value to a multidimentional array
A multidimensional array is a type of array which contains more than one arrays. These array functions in php can be narrative arrays or associative arrays.
![Assigning values to a multidimensional array Assigning values to a multidimensional array](https://howtech.tv/wp-content/images/001832/5.jpg)