April 2026
Intermediate
1009 pages
34h 15m
English
Square brackets can be used to access individual elements of an array. In practice, however, the most common task is to iterate through an array. This iteration is usually achieved using loops. However, there are also some functions that can be used as alternatives.
Before we get to the concrete solutions, a few thoughts on arrays in PHP. As you have already read, arrays with a numerical index are actually associative. Internally, the index and value are stored in the order in which they are added to the array. We will deal with this in the output sequence in a moment.
The for loop simply runs through a numeric array in the order of the indices. To do this, you must use the count(Array) function to determine ...
Read now
Unlock full access