What role does the print_r() function play in debugging PHP code?

The print_r() function in PHP is used to display human-readable information about a variable, array, or object. It is commonly used in debugging to inspect the contents of variables at runtime, helping developers identify issues in their code more easily.

// Example usage of print_r() for debugging
$myArray = array('apple', 'banana', 'cherry');
print_r($myArray);