Skip to content

Registering the shutdown function

Shutdown function: register_shutdown_function()

Suppose you have the exit() function called in multiple points. If you want to detect the shutdown triggered by exit() call, you can β€œregister” your function that you want to call once exit() is executed.

register_shutdown_function(function () {
echo 'Shutting down.', PHP_EOL;
exit("Good bye!");