What is the issue with extracting a key from a multidimensional array in PHP?

When extracting a key from a multidimensional array in PHP, the issue arises when trying to access a nested key directly using the array index notation. To solve this problem, you need to first access the nested array using its parent key, and then access the desired key within that nested array.

// Example multidimensional array
$nestedArray = [
    'parent' => [
        'child' => 'value'
    ]
];

// Extracting a key from a multidimensional array
$parentKey = 'parent';
$childKey = 'child';

$value = $nestedArray[$parentKey][$childKey];

echo $value; // Output: value