What are the limitations of using references in PHP for multi-dimensional arrays?

When using references in PHP for multi-dimensional arrays, there can be issues with unexpected behavior due to the way references are handled. To avoid these problems, it is recommended to use the `foreach` loop instead of directly manipulating the array with references.

// Example of using foreach loop to avoid issues with references in multi-dimensional arrays
$array = [
    'first' => ['a', 'b', 'c'],
    'second' => ['d', 'e', 'f'],
];

foreach ($array as &$subArray) {
    foreach ($subArray as &$value) {
        $value = strtoupper($value);
    }
}

print_r($array);