0Pricing
PHP Academy · Lesson

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]; // 99

All lessons in this course

  1. Indexed and Associative Arrays
  2. Multidimensional Arrays
  3. Sorting and Searching Arrays
  4. Array Transformation Functions
← Back to PHP Academy