HTML Academy
  • HTML Academy
  • Courses
  • Tutorials
  • Courses
  • Tutorials
  • Sign up
  • Log in
  • Home
  • Interactive courses
  • PHP basics
  1. Conditions in PHP 0/14
  2. Arrays and loops in PHP 0/15
  3. Arrays and functions in PHP 0/16
  4. Numbers and strings in PHP 0/14

Chapter 2: Arrays and loops in PHP

15 tasks, 1 summary

We will explore what arrays and loops are and find out why they work great together. You will work with different arrays and loops in the context of the pages of an online store. And you will also add product filtering functionality and solve a couple of additional problems.

Start
1. Outputting several elements to PHP Task
2. What are arrays? Task
3. Indexes of the array elements Task
4. Adding an element to the array by index Task
5. The while loop in PHP Task
6. Embedding the while loop in the template Task
7. Counting the number of elements in the array using the count command Task
8. Adding count to the template Task
9. Outputting elements from the array by id Task
10. The associative array in PHP Task
11. The foreach loop in PHP Task
12. Outputting array elements to the page using foreach Task
13. Including databases Task
14. Filtering products Task
15. Outputting all products to the page Task
16. Summary of “Arrays and loops in PHP: Part 1” Summary

Cookies ∙ Privacy ∙ License Agreement ∙ About ∙ Contacts ∙ © HTML Academy OÜ, 2019−2025

VISAMastercard

Log in

or

Forgot your password?

Sign up

Sign up

or
Log in

Restore access

Have you forgotten your password or lost access to your profile? Enter your email connected to your profile and we will send you a link to restore access.

Forgot to connect your email to the profile? Email us and we’ll help.

We are using cookies to gather information which will help you use our website most effectively. You can read about this here or disable this feature if you want. By continuing to browse the site, you agree to our use of cookies.