<p>Arrays in PHP (as in other languages) are a collection of values linked together. For example, a menu in a restaurant (name of the dish - price) or the number of people living in a country's cities (city of the country - number of inhabitants) can be represented as an array. As explained in this article, a variable is a named container in memory that contains a specific value. In this sense, an array is a container containing many values.</p> <p>An array can have only one element with a given key, i.e. the above array cannot have two elements with the key dinner. If we try to "add" a second dinner, we will simply overwrite the value of the existing element. In this example we have considered the most common case of array organization, namely as an associative array. An associative array is more convenient to use in code, because its keys have meaningful names (associated with some parts of the application or data processed by the script). But there is a simpler example of an array, these are numeric arrays. When creating them, you don't need to specify a key, it is set automatically as an integer starting from zero.</p> <p>As you already know, array elements can contain as a value data of any type, strings, numbers, logical, including other arrays. An array consisting of other arrays is called a multidimensional or nested array. In practice, 2-3 levels of nesting are used to store any related structural data (e.g., data of any type).</p>