What is the purpose of using array_keys() in PHP and how does it affect the output of an array?

The purpose of using array_keys() in PHP is to retrieve all the keys of an array. This function returns an array containing the keys of the input array. It can be useful when you need to work with just the keys of an array, for example, when you want to iterate over the keys or perform operations based on the keys.

// Example of using array_keys() to retrieve keys of an array
$array = array("a" => "apple", "b" => "banana", "c" => "cherry");
$keys = array_keys($array);

print_r($keys);