How can error_reporting be used to troubleshoot issues after upgrading PHP versions?

When upgrading PHP versions, there may be compatibility issues with existing code that can cause errors or warnings. To troubleshoot these issues, you can use the error_reporting function in PHP to display all errors, warnings, and notices. This can help identify the specific issues causing problems after the upgrade.

// Enable error reporting to display all errors, warnings, and notices
error_reporting(E_ALL);
ini_set('display_errors', 1);