Monday 1 October 2012

register_shutdown_function

void register_shutdown_function ( callable $callback [, mixed $parameter [, mixed $... ]] )
Register a function for execution on shutdown
Registers a callback to be executed after script execution finishes or exit() is called.

<?phpfunction shutdown()
{
    
// This is our shutdown function, in
    // here we can do any last operations
    // before the script is complete.

    
echo 'Script executed with success'PHP_EOL;
}
register_shutdown_function('shutdown');?>

4.1.0 The shutdown functions are now called as a part of the request. In earlier versions under Apache, the registered shutdown functions were called after the request has been completed (including sending any output buffers), so it was not possible to send output to the browser using echo or print, or retrieve the contents of any output buffers using ob_get_contents(). Headers were also always already sent.

PHP Pretty Fatal Errors