php basics

Wednesday, May 24, 2006

Exception Handling

Throw/catch
  • Throwing exceptions: Php can look for functions to handle problems if they come up in your programs. This is called "throwing an exception".

  • The error-handling function "catches the exception."
  • This makes it easy to identify and report exeption errors.

This is the basic structure:

  1. Try a piece of code
  2. In case of error (failure), throw an exception
  3. An error handler (which had been assigned to the type of exception thrown) catches it and "deals with it".
  4. Clean up resources used

0 Comments:

Post a Comment

<< Home