PHP - How to set up a function which will be called at the end of the execution of the PHP script?
Be aware that this function will be called even id the connection with the client has been aborted or timed out and in fact that's why this approach could be very useful in some cases. <?php function YourFunction() { ... } register_shutdown_function("YourFunction"); ?>