13.09.2016 Views

PHP and MySQL Web Development 4th Ed-tqw-_darksiderg

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Next<br />

567<br />

Figure 26.1<br />

You can give friendlier error messages than <strong>PHP</strong> if you use your<br />

own error h<strong>and</strong>ler.<br />

It is important to note that your error h<strong>and</strong>ler will not have the responsibility for<br />

dealing with all error types. Some errors, such as parse errors <strong>and</strong> fatal runtime errors,<br />

still trigger the default behavior. If this behavior concerns you, make sure that you check<br />

parameters carefully before passing them to a function that can generate fatal errors <strong>and</strong><br />

trigger your own E_USER_ERROR level error if your parameters are going to cause failure.<br />

Here’s a useful feature: If your error h<strong>and</strong>ler returns an explicit false value, <strong>PHP</strong>’s<br />

built-in error h<strong>and</strong>ler will be invoked.This way, you can h<strong>and</strong>le the E_USER_* errors<br />

yourself <strong>and</strong> let the built-in h<strong>and</strong>ler deal with the regular errors.<br />

Next<br />

In Chapter 27,“Building User Authentication <strong>and</strong> Personalization,” you begin your first<br />

project. In this project, you look at how to recognize users who are coming back to your<br />

site <strong>and</strong> tailor your content appropriately.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!