How can a multidimensional array be created and accessed in PHP, specifically when working with data from .ini files?

When working with data from .ini files in PHP, a multidimensional array can be created by using nested loops to parse the data and store it in the desired structure. To access the multidimensional array, you can simply reference the keys of each dimension to retrieve the corresponding values.

// Load data from .ini file
$data = parse_ini_file('data.ini', true);

// Create a multidimensional array
$multiArray = [];
foreach ($data as $key => $value) {
    $keys = explode('.', $key);
    $temp =& $multiArray;
    foreach ($keys as $innerKey) {
        $temp =& $temp[$innerKey];
    }
    $temp = $value;
}

// Access the multidimensional array
echo $multiArray['section']['key']; // Output: value