Introduction to PHP – Getting to Know Arrays Part 3

In part 2 of our tutorial with arrays we talked about how to loop through an array and its indexes with for and foreach loops. This time around you'll be learning with PHP Associative Arrays. In which named keys are used in assigning the contents.

There are two ways to create an associative array the first one is through:

Associative arrays are useful in passing values from one function to another. And as well as keeping your code clean and easy to understand. This is also used in inserting database. In which each key is different and can be used as the named of the values, name of the table, database or just about everything.