This post will provide the detailed explanation of the register_shutdown_function. We can register a user defined function at the end/termination of the PHP script.

We can handle the PHP Fatal Errors using the combination of the register_shutdown_function() and error_get_last() functions.
register_shutdown_function() will register your script ending handler and error_get_last() will provide the detail of the last error occured.

Meet the Expert Developer  php5.in For Sale