If you are not fortunate enough to be a subscriber to PHP magazine, you may want to take a look at this great error handling class presented last issue by Peter James.
The class introduces a few interesting programming ideas, like inner functions and using them to override PHP’s default error handling.
August 8th, 2003 at 12:44 pm
At first glance the inner function idea seems like a lot of
work to get around a feature built into PHP.
He could have just done:
Of course he has an excludes array and a line number counter
which are static parameters so you may need to revise the code
to:
Someone tell me why I need an inner function and two
globals?
Methinks some people need to spend more time reading the
(very incomplete!) documentation at PHP.net!
August 9th, 2003 at 8:02 pm
If you read the documentation in the class *and* on php.net for set_error_handler(), you will see that it did not accept anything but a standard function name before php 4.3… And this was written well before php 4.3.
Thanks,
Pete.
August 9th, 2003 at 8:04 pm
Oops, I just noticed that the version posted here has no comments.
Take a look at http://php.shaman.ca/eh/error_handler.phps