In PHP5 there is yet another error trapping mechanism, exceptions. Exceptions, allow error tracking inside an entire block of code with just a few lines.

Unfortunately, only newest PHP extensions can throw exceptions and do so only when working with OO interface.