How can error handling be improved in PHP scripts to provide more useful information for debugging purposes?

Error handling in PHP scripts can be improved by using the `try`, `catch`, and `finally` blocks to catch exceptions and handle them gracefully. Additionally, using functions like `error_reporting` and `ini_set` to display errors can provide more useful information for debugging purposes.

try {
    // Code that may throw an exception
    throw new Exception('An error occurred');
} catch (Exception $e) {
    // Handle the exception
    echo 'Caught exception: ' . $e->getMessage();
} finally {
    // Optional cleanup code
}