In what scenarios would one need to utilize multi-dimensional arrays in PHP?

Multi-dimensional arrays in PHP are useful when dealing with data that has multiple levels of categorization or when working with matrices and tables. For example, a multi-dimensional array can be used to store information about students in a school, where each student has multiple attributes like name, age, and grades. This allows for easy access and manipulation of data in a structured manner.

// Example of using a multi-dimensional array to store student data
$students = array(
    array("name" => "John", "age" => 20, "grades" => array(85, 90, 88)),
    array("name" => "Jane", "age" => 22, "grades" => array(78, 95, 87)),
    array("name" => "Alice", "age" => 21, "grades" => array(92, 89, 91))
);

// Accessing data from the multi-dimensional array
echo $students[0]["name"]; // Output: John
echo $students[1]["grades"][1]; // Output: 95