Now let's discuss about arrays
An array is a group of elements
It can have many dimensions
It can be displayed in a table, that is limited to 2 dimensions
The problem when you generate a table from an array is you don't know if there is 1 or 2 dimension(s)
An array with one line will have 1 dimension (one y (line) with many x (columns))
An array with 2 line, with 5 columns each will have 2 dimensions (the y and the x)
Y is the line (vertical dimension)
X is the column (horizontal dimension)
example:
Because we do not know how many dimension the array have
We do not decide how many dimensions we have, because we will fill the array with data from a table, and the table might have only one line...
Since our data is not know, it can have one line or many, one dimension or many
If we ask how many elements there is in the second dimension and there is only one dimension, the script will generate an error
NEXT:
We will see how to generate an html table with an array that can have 1 or 2 dimension(s)
Because it's late and i'll go to bed, good night!
No comments:
Post a Comment