11.5.2.1 use the technical terms associated with arrays including upper and lower bounds Two dimentional arrays (Matrix)
Each element of a two-dimensional array has two indices: row number (i) and column number (j). Programmers usually indicate the line number of the variable i , the number of the column of the variable j.
You can get the value of an element by two indexes. For example, arr[2][3] A two-dimentional arra is used to create a table of data in rows and columns with the same data type. Create 2D Array We can create the two-dimensional array shown above: $grid= array( An array $grid we can visually represent in a table:
$grid[0][3] = 'A' 2D iteration Nested loops are used to iterate over all elements of a two-dimensional array. FOR i = 0 to N FOR j = 0 to N Fill 2D array random number (PHP)for ($row = 0; $row < 6; $row++){ Output 2D array in table (PHP)echo "<table border=1>"; Next lineprint "<br>";
Questions: Exercises: Tasks: | |
| |
Просмотров: 2308 | | |
Всего комментариев: 0 | |