What is the purpose of the array_keys() function in PHP and how does it work with multidimensional arrays?

The array_keys() function in PHP is used to retrieve all the keys of an array. When working with multidimensional arrays, array_keys() can be used to get the keys of the outer array or a specific dimension within the array. Example: To get the keys of a multidimensional array, you can specify the dimension as the second argument in the array_keys() function.

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

$keys = array_keys($multiArray);
print_r($keys);