★ wanayoo — archive 1999 http://www.php.net/manual/function.register-shutdown-function.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to Misc.
Quick Reference
Misc.
* connection_aborted
* connection_status
* connection_timeout
* define
* defined
* die
* eval
* exit
* func_get_arg
* func_get_args
* func_num_args
* function_exists
* get_browser
* ignore_user_abort
* iptcparse
* leak
* pack
* register_shutdown_function
* serialize
* sleep
* uniqid
* unpack
* unserialize
* usleep
Manual: register_shutdown_function
View the source code for this pageSearch the site



Previous page
 pack
serialize 
Next page


register_shutdown_function

register_shutdown_function -- Register a function for execution on shutdown.

Description

int register_shutdown_function (string func);

Registers the function named by func to be executed when script processing is complete.

Common Pitfalls:

Since no output is allowed to the browser in this function, you will be unable to debug it using statements such as print or echo.


User Contributed Notes: register_shutdown_function


ieure@mindspring.com
21-Sep-1999 01:37
Does anyone know what the scope of this function is? For example, if I have a shutdown function registered for my main script, and one for an included class, will they both execute, or will the last one registered execute?


jmat@firewind.net
09-Oct-1999 07:16
Don't put an "exit;" in your shutdown function, or your page will never load past the register_shutdown_function line.


jkraai@murl.com
29-Nov-1999 10:05
Whenever using register_shutdown...() and having the need to use exit;, I make another function, nice_exit() that calls whatever shutdown function was registered and then doing a hard exit:
function my_shutdown() {
    // Whatever cleanup routines, DB, logging, etc.
}

function nice_exit() {
    // Call the register shutdown function
    my_shutdown();
    // Hard Exit
    exit;
}

register_shutdown_function("my_shutdown");
and in normal code, I use nice_exit() in place of exit;
// code to execute
if ($some_condition) {
    nice_exit();
}
// code that might not execute



jeanarthur@eurovox.fr
23-Feb-2000 12:07
When using the register function, the user cannot execute another PHP script while the register function is not terminated... Does anyone knows how to prevent this ?


 About Notes


Previous page
 pack
serialize 
Next page



Site Statistics


Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.