Multidimensional Arrays
Build and navigate arrays of arrays.
Multidimensional Arrays
A multidimensional array is an array where each element is itself an array. Common for structured data like database results or config trees.
2D Array Creation
Create and access a two-dimensional array:
<?php
$matrix = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
];
echo $matrix[1][2]; // 6 (row 1, col 2)
$matrix[0][0] = 99;
echo $matrix[0][0]; // 99All lessons in this course
- Indexed and Associative Arrays
- Multidimensional Arrays
- Sorting and Searching Arrays
- Array Transformation Functions