How can PHP arrays be used in a multidimensional way within a template system?

When using PHP arrays in a multidimensional way within a template system, you can pass a multidimensional array to the template and then access its values using nested loops or by specifying the keys directly. This allows you to organize and display data in a structured manner within your template.

// Example of passing a multidimensional array to a template
$data = [
    'users' => [
        ['name' => 'John', 'age' => 25],
        ['name' => 'Jane', 'age' => 30],
    ]
];

// Template code
foreach ($data['users'] as $user) {
    echo $user['name'] . ' is ' . $user['age'] . ' years old.<br>';
}