PHP TutorialLesson 21Free preview
PHP Arrays
This lesson is part of PHP · All levels
Summary
An array is a data type that can store many values in one variable, so data can be easily grouped and processed. This lesson discusses how to create an array, access elements based on indices starting from zero, and repeat the array content with foreach. There's also an inborn function to sort and calculate the elements.
Key points
- The array holds many values in one variable
- The index of PHP arrays starts from 0
- Count the number of elements, sort up
- Foreach is the most practical way to repeat the entire array element
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.