What is PhpDig?
PhpDig is a PHP MySQL based
Web Spider & Search Engine.



register_shutdown_function — Calls a function when the current script ends.


void register_shutdown_function(function_name);
string function_name:




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 no further output will be sent to the browser when the registered functions are called. This means that calls to print() or echo() will not display any data. Also, errors generated at runtime by the registered functions will not be sent to the browser.


PHP Version: 3.0.4+, 4+


Example 386. Warn the server admin when a script times out

// Create function that mails the server admin when a script has timed out
function alert_admin ()
    if (connection_timeout ())
        mail (
            "Script $SCRIPT_NAME timed out.",
            "$SCRIPT_NAME timed out - you may want to increase the max_execution_time value in your php.ini file.",

// Set the function up to be called when the script ends.
register_shutdown_function ('alert_admin');

// Lots of other code
// ...

PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing (Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch). This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at The authors of this book have elected not to choose any options under the OPL. This online book was obtained from and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4 for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All persons and entities shall have neither liability nor responsibility to any person or entity with respect to any loss or damage arising from the information contained in this book.

Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.