PHP Multidimensional Arrays | Tutorial

Publié le: 09 mai 2019
sur la chaîne: YouAccel
3
0

Course Title: Web Development Masterclass
Course Link: http://youaccel.com/admin/cdisplay.ph...

Facebook:   / youaccel  
Twitter:   / youaccel  
Website: http://youaccel.com

Tutorial Content:

In the last tutorial, we explored the associative array using a single named key.

In this lesson we will create an array that holds multiple key/value pairs, known as a Multidimensional Array.

A multidimensional array is an array that contains one or more arrays.

First let's look at the following example.

Here we have a student's name followed by the grades each student has received on two tests.
In our example, we have stored the data in each row in an array.
The first array, has the name John and his two test scores. Followed by Bob, Sam and Ted.

We have four arrays in total. Each array's values can be accessed using its position in the table we looked at earlier.
The value is actually it's index number, but the table makes things much easier to understand.

Taking a look at our first echo statement, we can see that:

The value John in a array 1, has an index number of [0][0].
John's first test score has an index number of [0][1].
John's second test score has an index number of [0][2].

Now let's output Bob and his two test scores.
The value Bob has an index number of [1][0]
Bob's first test score has an index number of [1][1]
Bob's second test score has an index number of [1][2]

Next we will output Sam and his two test scores.
The value Sam has an index number of [2][0]
Sam's first test score has an index number of [2][1]
Sam's second test score has an index number of [2][2]
By now you can probably see the pattern.

You can Apply the same concept to output Ted's test scores.


Sur cette page du site, vous pouvez voir la vidéo en ligne PHP Multidimensional Arrays | Tutorial durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur YouAccel 09 mai 2019, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 3 fois et il a aimé 0 téléspectateurs. Bon visionnage!