No cache version.

Caching disabled. Default setting for this page:enabled (code LNG204)
If the display is too slow, you can disable the user mode to view the cached version.

Rechercher une fonction PHP

register_shutdown_function

(PHP 4, PHP 5, PHP 7)

register_shutdown_functionRegister a function for execution on shutdown

Description

register_shutdown_function ( callable $callback [, mixed $... ] ) : void

Registers a callback to be executed after script execution finishes or exit() is called.

Multiple calls to register_shutdown_function() can be made, and each will be called in the same order as they were registered. If you call exit() within one registered shutdown function, processing will stop completely and no other registered shutdown functions will be called.

PHP: register_shutdown_function - Manual Home of Manuel PHP  Contents Haut

Parameters

callback

The shutdown callback to register.

The shutdown callbacks are executed as the part of the request, so it's possible to send output from them and access output buffers.

...

It is possible to pass parameters to the shutdown function by passing additional parameters.

PHP: register_shutdown_function - Manual Home of Manuel PHP  Contents Haut

Errors/Exceptions

If the passed callback is not callable a E_WARNING level error will be generated.

PHP: register_shutdown_function - Manual Home of Manuel PHP  Contents Haut

Examples

Example #1 register_shutdown_function() example

<?php
function 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');
?>

PHP: register_shutdown_function - Manual Home of Manuel PHP  Contents Haut

Notes

Note:

Working directory of the script can change inside the shutdown function under some web servers, e.g. Apache.

Note:

Shutdown functions will not be executed if the process is killed with a SIGTERM or SIGKILL signal. While you cannot intercept a SIGKILL, you can use pcntl_signal() to install a handler for a SIGTERM which uses exit() to end cleanly.

PHP: register_shutdown_function - Manual Home of Manuel PHP  Contents Haut

See Also

Find a PHP function
Error Infobrol

Can not display this page of the Infobrol website

Type of error (18-01)

Unknown format specifier "&"

Please try again in a few minutes…

Return to the home page




Steph