What potential issues can arise when using foreach loops in PHP with multidimensional associative arrays?

When using foreach loops with multidimensional associative arrays in PHP, the key-value pairs of the inner arrays may not be accessible directly. To solve this, you can use nested foreach loops to iterate through both the outer and inner arrays.

$multiArray = array(
    "first" => array("a" => 1, "b" => 2),
    "second" => array("c" => 3, "d" => 4)
);

foreach ($multiArray as $key => $innerArray) {
    echo "Key: " . $key . "<br>";
    foreach ($innerArray as $innerKey => $value) {
        echo "Inner Key: " . $innerKey . ", Value: " . $value . "<br>";
    }
}