In the previous chapter, we covered variables and data types along with the different operators. We also covered how to control the flow of programs using conditionals. In this chapter, we will focus on how to store multiple values using arrays and how to control the flow using loops. The basic idea of an array is that it is a variable type, allowing one to store multiple items within a single
container
.
For example, if you wanted to store the names of all the employees working in a company under the same variable, an array would help you do that. Loops are used when we want to run the same block of code multiple times. This saves a lot of work for the developer by reusing the pre-defined code block. These two concepts are at the core of almost every PHP-based web application and website on the web today.
By the end of this chapter, you will be able to:
Implement one-dimensional and multidimensional arrays
Identify the difference between indexed and associative...