How can error reporting be used to troubleshoot issues with the include function in PHP?

When troubleshooting issues with the include function in PHP, error reporting can be used to identify any errors or warnings that may be causing the include to fail. By enabling error reporting, you can see specific error messages that can help pinpoint the issue, such as incorrect file paths or permissions problems. This information can then be used to fix the problem and ensure that the include function works as intended.

<?php
// Enable error reporting
error_reporting(E_ALL);
ini_set('display_errors', 1);

// Include the file
include 'file.php';
?>