register_shutdown_function

void register_shutdown_function(string function_name) 

Calls a function when the current script ends.

Returns:

NULL

Description:

register_shutdown_function() allows the developer to register one or more functions to be called when the script ends. This function is very useful when you need to create automatic cleanup handlers.

The functions will be called in the order that the calls to register_shutdown_function() were made. If the script is terminated with a call to exit() or die(), the registered function(s) will not be called. Similarly, if one of the registered functions calls exit() or die(), the functions that were registered after it will not be called.

When using register_shutdown_function(), remember that ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.