You can reduce the number of errors in your application by using good programming practices; however, many factors cause errors that are beyond our control in a script. Network outages, full hard disks, hardware failure, bugs in other PHP components, or programs your application interacts with can all cause errors that are not due to any fault of your PHP code.
If you do nothing to deal with such errors, PHP's default behavior is to show the error message to the user, along with a link to the page in the manual describing the function that failed, as well as the file name and line of the code that triggered the error. For most errors, PHP keeps running after displaying this message. See Figure 7.1.
Figure 7.1. PHP error message.
This error message is really meant for you, the developer, not for the users of your site. Users would appreciate a page explaining, in layman's terms, what went wrong and have no interest in documentation links or the location of your code.
PHP provides a number of options to deal with such errors in a better way. After you finish reading this chapter, you will have learned