Two-dimensional arrays can omit rows. Because two-dimensional arrays are stored "rows first, columns second", if you don't specify the number of columns, you can't know how many data can be placed in one row. As long as you know the number of columns, you can know how many rows can be placed in the top row.
Two-dimensional arrays can omit rows.
Reason:
Because the two-dimensional array is stored in "rows first, columns second", if the number is not specified, he cannot know how many numbers are placed in one row.
As long as you know the number of columns and put them first, you can know how many rows can be placed in total.
When defining a two-dimensional array, after omitting it, the computer must be able to determine the number of rows and columns you define
If you omit the number of rows but determine the number of columns, the computer will determine the number of columns according to your The number of columns and the data you give when initializing automatically determine the number of rows, so the number of rows can be omitted.
But if the number of rows is given but the number of columns is not determined, the computer does not know how to divide the data you initialized. What is the average score? Or divide it in other ways? This is not regulated, and errors may occur.
For more related knowledge, please visit PHP Chinese website! !
The above is the detailed content of Can rows or columns be omitted in a two-dimensional array?. For more information, please follow other related articles on the PHP Chinese website!