📄️ Arrays In PHP
An array is a special type of variable that can hold multiple values. Arrays are useful for storing lists of data.
📄️ Array Functions
In the last lesson, we looked at creating arrays and manipulating them using the element index. In this lesson, we will look at some of the built-in array functions that PHP provides. There are so many of these functions that it would be impossible to cover them all in this video, so I will cover some common ones. We will also use other ones throughout the course.
📄️ Associative Arrays
Associative arrays are used to store key value pairs. The keys can be strings or numbers. The values can be any type. If you are coming from the JavaScript world, associative arrays are similar to object literals or dictionaries in Python.
📄️ Muti-Dimensional Arrays
A multi-dimensional array is an array of arrays. It is common to fetch data from a database and store it in an array of associative arrays.
📄️ Basic Loops
Now we are going to start to get into loops and iteration. Loops are used to repeat a block of code a certain number of times. This is useful when you want to do something a certain number of times, or when you want to do something for each item in an array.
📄️ Nested Loops
There may be cases where you need to use a loop inside of another loop. This is called a nested loop. Let's look at an example of a nested for loop:
📄️ Looping Through Arrays
One of the most useful things you can do with an array is loop through it. This allows you to perform the same action on each item in the array. There are many different ways to loop through an array. Let's look at a few.
📄️ Mutli-Dimensional Array Iteration and HTML Output
Let's use the knowledge we have now to create a page that lists job openings and their descriptions. We will create an array with the data and display them nicely.
📄️ Array & Loop Challenges
Challenge 1: Multiplication Table