Like most programming languages, PHP lets you create arrays. An array is a special type of variable that can hold many values at once, all accessible via a single variable name. Arrays are very useful whenever you need to work with large amounts of data — such as records from a database — or group related data together.
In this article, you’ll:
- Learn how PHP arrays work, and why they’re useful
- Look at the difference between indexed arrays and associative arrays, and
- Learn how to create arrays within your PHP scripts.