PHP Program to Output elements from a multidimensional array

In the following example of PHP program that demonstrates how to output elements from a multidimensional array :
Program :
<?php

// Create a multidimensional array
$cars = array(
    array("Make" => "Ford", "Model" => "Mustang", "Year" => 2020),
    array("Make" => "Chevrolet", "Model" => "Corvette", "Year" => 2021),
    array("Make" => "Dodge", "Model" => "Challenger", "Year" => 2019)
);

// Loop through the array and print the values
foreach($cars as $car) {
    echo "Make: " . $car["Make"] . "<br>";
    echo "Model: " . $car["Model"] . "<br>";
    echo "Year: " . $car["Year"] . "<br><br>";
}

?>
Output :
Make: Ford
Model: Mustang
Year: 2020

Make: Chevrolet
Model: Corvette
Year: 2021

Make: Dodge
Model: Challenger
Year: 2019
In the above example, we have created a multidimensional array `$cars` that contains three sub-arrays, each representing a car with its make, model, and year.

We use a `foreach` loop to iterate through the array and print the values of each element. The `$car` variable represents each sub-array in the loop.

To access the values of the elements in the sub-arrays, we use the key names "Make", "Model", and "Year" with the `$car` variable to access the corresponding values.

This allows us to output the elements from the multidimensional array in a structured format.