How can the use of print_r() function help in debugging PHP code related to arrays?

When debugging PHP code related to arrays, the print_r() function can be incredibly helpful as it allows you to print out the contents of an array in a human-readable format. This can help you quickly identify the structure of the array, the values it contains, and any potential issues with the data. By using print_r() in conjunction with other debugging techniques, you can efficiently troubleshoot array-related problems in your PHP code.

<?php
// Sample array for demonstration
$fruits = array("apple", "banana", "orange");

// Using print_r() to output the contents of the array
print_r($fruits);
?>