How can the print_r function be used to debug and analyze the structure of an array in PHP?

To debug and analyze the structure of an array in PHP, you can use the print_r function. This function will display the entire structure of the array, including keys and values, making it easier to identify any issues or inconsistencies. By using print_r, you can quickly visualize the contents of the array and make necessary adjustments to your code.

$array = array('apple', 'banana', 'cherry');
print_r($array);