How can errors be effectively handled in PHP to troubleshoot issues like a blank page?

When troubleshooting issues like a blank page in PHP, errors can be effectively handled by enabling error reporting and displaying errors on the page. This can help identify the specific error that is causing the blank page and provide more information for troubleshooting.

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

// Your PHP code here
?>