HOW TO: Catch PHP Errors and Warnings

This morning I was faced with an issue with SwiftMailer where the PHP code was throwing an error message as it failed to connect with the mail server. To solve it I first thought of using a try/catch, but obviously that wouldn’t work due to the fact that the...