Jani Hartikainen has a suggestion for all PHP developers out there - stop using die() for handling errors!
Whatâ€™s the most common pattern for error handling you see in beginnerâ€™s PHP code? - Thatâ€™s right, do_X() or die('do_X failed);. Thatâ€™s nice and all, as at least you have some sort of error handling, but I think this way of handling errors must go. There is no place for it in modern PHP code - itâ€™s the worst way to handle errors, not much better than not handling them at all.
He talks about why die() is so bad and some alternatives to it - trigger_error (with a custom error handler) and exceptions. When used correctly, these two can help your script correctly catch and handle errors without the mess of a die().