How can error reporting be enabled in PHP to troubleshoot issues during script execution?

To enable error reporting in PHP, you can set the error_reporting directive in your PHP script to display all types of errors, warnings, and notices. This can help troubleshoot issues during script execution by providing detailed information about any errors that occur.

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