Computer science: array vs associative array

Tutoring computer science, data storage types are topical. The tutor mentions associative arrays.

An array is a data type: in particular, it’s a means of storing multiple data values. Typically, if it’s just called an array, the values are understood to be organized by order: the zeroth element, the first element, the second, and so on. Note this produces pairs of data: (0, something), (1, something_else), etc. In such an array, however, the positions might be implicit: [something, something_else,…]

With an associative array, the pairs of data are based on an attribute and its value. Then, the array might be like this: [(height, 180),(eye_color, brown), (age,27)].

Source:

php.net/manual

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Leave a Reply