Handling fatal error in PHP with register_shutdown_function

PHP 5.2.0 bring us a new function : error_get_last()

It return an associative array describing the last error with keys “type”, “message”, “file” and “line” about the last error that occurred.

We can now use it with register_shutdown_function to handle fatal error, log, redirect, html page, instead of the infamous white page.

Resources :

  • http://www.php.net/manual/en/function.error-get-last.php
  • http://php.net/manual/en/errorfunc.constants.php

1 Response

  1. Suraj Kumar Adhikari says:

    Awesome information!!! thanks

Leave a Reply