PHP 7.2.0 Release Candidate 4 Released

register_shutdown_function

(PHP 4, PHP 5, PHP 7)

register_shutdown_functionRegister a function for execution on shutdown

Description

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

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.

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.

parameter

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

...

Return Values

No value is returned.

Errors/Exceptions

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

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

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.

See Also

add a note add a note

User Contributed Notes 56 notes

up
119
jules at sitepointAASASZZ dot com
14 years ago
If your script exceeds the maximum execution time, and terminates thusly:

Fatal error: Maximum execution time of 20 seconds exceeded in - on line 12

The registered shutdown functions will still be executed.

I figured it was important that this be made clear!
up
32
http://livejournal.com/~sinde1/
11 years ago
If you want to do something with files in function, that registered in register_shutdown_function(), use ABSOLUTE paths to files instead of relative. Because when script processing is complete current working directory chages to ServerRoot (see httpd.conf)
up
5
Filip Dalge
8 years ago
The following function register_close_function should reproduce the former php behavior of closing the connection before executing the shutdown handler, based on the code posted by sts at mail dot xubion dot hu. It does not work on any machine.

<?php
function register_close_function($func) {
 
register_close_function::$func = $func;
 
register_shutdown_function(array("register_close_function", "close"));
 
ob_start();
}
class
register_close_function {
 
// just a container
 
static $func;
  function
close() {
   
header("Connection: close");
   
$size = ob_get_length();
   
header("Content-Length: $size");
   
ob_end_flush();
   
flush();
   
call_user_func(register_close_function::$func);
  }
}
?>
up
8
m dot agkopian at gmail dot com
3 years ago
Use this small snippet inside your bootstrap in order to always have a way to know reliably what was the last page of your site that the user have visited, without having to use $_SERVER['HTTP_REFERER'].

<?php
session_start
();

// Get current page
$current_page = htmlspecialchars($_SERVER['SCRIPT_NAME'], ENT_QUOTES, 'UTF-8');
$current_page .= $_SERVER['QUERY_STRING'] ? '?'.htmlspecialchars($_SERVER['QUERY_STRING'], ENT_QUOTES, 'UTF-8') : '';

// Set previous page at the end
register_shutdown_function(function ($current_page) {
   
$_SESSION['previous_page'] = $current_page;
},
$current_page);
?>
up
5
James Wyse (James [at] tastyspoon.com)
13 years ago
Just a note to say that if your function uses paths relative to the script you are running (ie. for reading files, "../dir/" etc) then your function may not work correctly when registered as a shutdown function. I'm not sure where the 'working dir' IS when running a shutdown function but I find it best to use absolute paths ("/home/www/dir/").
up
19
ravenswd at gmail dot com
7 years ago
You may get the idea to call debug_backtrace or debug_print_backtrace from inside a shutdown function, to trace where a fatal error occurred. Unfortunately, these functions will not work inside a shutdown function.
up
13
emanueledelgrande ad email dot it
7 years ago
A lot of useful services may be delegated to this useful trigger.
It is very effective because it is executed at the end of the script but before any object destruction, so all instantiations are still alive.

Here's a simple shutdown events manager class which allows to manage either functions or static/dynamic methods, with an indefinite number of arguments without using any reflection, availing on a internal handling through func_get_args() and call_user_func_array() specific functions:

<?php
// managing the shutdown callback events:
class shutdownScheduler {
    private
$callbacks; // array to store user callbacks
   
   
public function __construct() {
       
$this->callbacks = array();
       
register_shutdown_function(array($this, 'callRegisteredShutdown'));
    }
    public function
registerShutdownEvent() {
       
$callback = func_get_args();
       
        if (empty(
$callback)) {
           
trigger_error('No callback passed to '.__FUNCTION__.' method', E_USER_ERROR);
            return
false;
        }
        if (!
is_callable($callback[0])) {
           
trigger_error('Invalid callback passed to the '.__FUNCTION__.' method', E_USER_ERROR);
            return
false;
        }
       
$this->callbacks[] = $callback;
        return
true;
    }
    public function
callRegisteredShutdown() {
        foreach (
$this->callbacks as $arguments) {
           
$callback = array_shift($arguments);
           
call_user_func_array($callback, $arguments);
        }
    }
   
// test methods:
   
public function dynamicTest() {
        echo
'_REQUEST array is '.count($_REQUEST).' elements long.<br />';
    }
    public static function
staticTest() {
        echo
'_SERVER array is '.count($_SERVER).' elements long.<br />';
    }
}
?>

A simple application:

<?php
// a generic function
function say($a = 'a generic greeting', $b = '') {
    echo
"Saying {$a} {$b}<br />";
}

$scheduler = new shutdownScheduler();

// schedule a global scope function:
$scheduler->registerShutdownEvent('say', 'hello!');

// try to schedule a dyamic method:
$scheduler->registerShutdownEvent(array($scheduler, 'dynamicTest'));
// try with a static call:
$scheduler->registerShutdownEvent('scheduler::staticTest');

?>

It is easy to guess how to extend this example in a more complex context in which user defined functions and methods should be handled according to the priority depending on specific variables.

Hope it may help somebody.
Happy coding!
up
3
SonOfTron
9 years ago
You can achieve similar results by using auto_append_file in the php.ini or .htaccess file:
(php.ini)
auto_append_file = /my-auto-append-file.php
(.htaccess)
php_value auto_append_file /my-auto-append-file.php
up
6
Anonymous
14 years ago
When using CLI ( and perhaps command line without CLI - I didn't test it) the shutdown function doesn't get called if the process gets a SIGINT or SIGTERM. only the natural exit of PHP calls the shutdown function.
To overcome the problem compile the command line interpreter with --enable-pcntl and add this code:

<?php
function sigint()
{
    exit;
}
pcntl_signal(SIGINT, 'sigint');
pcntl_signal(SIGTERM, 'sigint');
?>

This way when the process recieves one of those signals, it quits normaly, and the shutdown function gets called.
Note: using the pcntl function in web server envoirment is considered problematic, so if you are writing a script that runs both from the command line and from the server, you should put some conditional code around that block that identifies wheater this is a command line envoirment or not.
up
11
clover at fromru dot com
7 years ago
If you register function that needs to be running last (for example, close database connection) - just register another shutdown function from shutdown function:
<?php
function test1(){
 
register_shutdown_function('test_last');
}

function
test2(){/*...*/}
function
test3(){/*...*/}
function
test_last(){/*...*/}

register_shutdown_function('test1');
register_shutdown_function('test2');
register_shutdown_function('test3');
?>

the script will call functions in correct order: test1, test2, test3, test_last
up
7
dweingart at pobox dot com
11 years ago
I have discovered a change in behavior from PHP 5.0.4 to PHP 5.1.2 when using a shutdown function in conjunction with an output buffering callback.

In PHP 5.0.4 (and earlier versions I believe) the shutdown function is called after the output buffering callback.

In PHP 5.1.2 (not sure when the change occurred) the shutdown function is called before the output buffering callback.

Test code:
<?php
function ob_callback($buf) {
   
$buf .= '<li>' . __FUNCTION__ .'</li>';
    return
$buf;
}

function
shutdown_func() {
    echo
'<li>' . __FUNCTION__ .'</li>';
}

ob_start('ob_callback');
register_shutdown_function('shutdown_func');
echo
'<ol>';
?>

PHP 5.0.4:

1. ob_callback
2. shutdown_func

PHP 5.1.2:

1. shutdown_func
2. ob_callback
up
10
pgl at yoyo dot org
8 years ago
You definitely need to be careful about using relative paths in after the shutdown function has been called, but the current working directory doesn't (necessarily) get changed to the web server's ServerRoot - I've tested on two different servers and they both have their CWD changed to '/' (which isn't the ServerRoot).

This demonstrates the behaviour:

<?php
function echocwd() { echo 'cwd: ', getcwd(), "\n"; }

register_shutdown_function('echocwd');
echocwd() and exit;
?>

Outputs:

cwd: /path/to/my/site/docroot/test
cwd: /

NB: CLI scripts are unaffected, and keep their CWD as the directory the script was called from.
up
7
adam at saki dot com dot au
15 years ago
When using objects the syntax register_shutdown_function(array($object, 'function')) will take a copy of the object at the time of the call.  This means you cannot do this in the constructor and have it correctly destruct objects.  The alternative is to use register_shutdown_function(array(&$object, 'function')) where the ampersand passes the reference and not the copy.  This appears to work fine.
up
9
david dot schueler at tel-billig dot de
6 years ago
I had a problem when forking a child process and accessing the variables by using the "global" keyword in the shutdown function.
So i used another way for getting the variables to the shutdown function: I passed them by reference.

Example:
<?php
function shutdown_function (&$test) {
    echo
__FUNCTION__.'(): $test = '.$test."\n";
}

$test = 1;
register_shutdown_function('shutdown_function', &$test);
echo
'$test = '.$test."\n";

// do some stuff and change the variable values
$test = 2;

// now the shutdown function gets called
exit(0);
?>

Maybe tis helps someone. (I'm using PHP 5.2.11)
up
2
matteosistisette at gmail dot com
4 years ago
In PHP 5.1.6 things don't work as described here.

The truth is that connection_status() just always returns 0 whether or not the client has aborted (e.g. the user hit the stop button), and that (consistently with this) the registered shutdown function will only be called on exit, but NOT when the connection is aborted from the user.

That is, PHP does NOT detect when the connection is aborted.
up
4
Ant P.
8 years ago
As of PHP 5.3.0, the last note about unpredictable working directory also applies to FastCGI, when previously it didn't.
up
4
Anonymous
8 years ago
Note that if the handler function is private static it will never be called! It must be public!
up
6
phpmanual at NO_SPHAMnetebb dot com
13 years ago
Given this code:

<?php
class CallbackClass {
    function
CallbackFunction() {
       
// refers to $this
   
}

    function
StaticFunction() {
       
// doesn't refer to $this
   
}
}

function
NonClassFunction() {
}
?>

there appear to be 3 ways to set a callback function in PHP (using register_shutdown_function() as an example):

1: register_shutdown_function('NonClassFunction');

2: register_shutdown_function(array('CallbackClass', 'StaticFunction'));

3: $o =& new CallbackClass();
   register_shutdown_function(array($o, 'CallbackFunction'));

The following may also prove useful:

<?php
class CallbackClass {
    function
CallbackClass() {
       
register_shutdown_function(array(&$this, 'CallbackFunction')); // the & is important
   
}
   
    function
CallbackFunction() {
       
// refers to $this
   
}
}
?>
up
4
sezer yalcin
11 years ago
re:codeslinger at compsalot dot com

fork() is actually creating 2 processes from one. So there is no surprise register_shutdown_function will be executed per each process.

I think you have reported this as a bug and now in php 5.1.0 when you exit from child process, it does not execute it. Well, what are you going to do if you have something to register for forked process?

I hope php will be more stable near soon!

codeslinger at compsalot dot com
03-Feb-2005 09:22
Here is a nice little surprise to keep in mind...

If you register a shutdown function for your main program.  And then you fork() a child.

Guess What?
When the child exits it will run the code that was intended for the main program.  This can be a really bad thing  ;-)

Happily there is a simple work-around.  All you need to do is to create a global variable such as:

$IamaChild = [TRUE | FALSE];

and have your shutdown function check the value...
up
4
sts at mail dot xubion dot hu
13 years ago
If you need the old (<4.1) behavior of register_shutdown_function you can achieve the same with "Connection: close" and "Content-Length: xxxx" headers if you know the exact size of the sent data (which can be easily caught with output buffering).
An example:
<?php
header
("Connection: close");
ob_start();
phpinfo();
$size=ob_get_length();
header("Content-Length: $size");
ob_end_flush();
flush();
sleep(13);
error_log("do something in the background");
?>

The same will work with registered functions.
According to http spec, browsers should close the connection when they got the amount of data specified in Content-Length header. At least it works fine for me in IE6 and Opera7.
up
11
Tim
3 years ago
register_shutdown_function seems to be immune to whatever value was set with set_time_limit or the max_execution_time value defined in php.ini.
<?php
function asdf() {
    echo
microtime(true) . '<br>';
   
sleep(1);
    echo
microtime(true) . '<br>';
   
sleep(1);
    echo
microtime(true) . '<br>';
}
register_shutdown_function('asdf');
set_time_limit(1);

while(
true) {}
?>
The output is three lines.
up
7
Jim Smith
13 years ago
I was trying to figure out how to pass parameters to the register_shutdown_function() since you cannot register a function with parameters and passing through globals is not appropriate. E.g. what I was trying to do was  <? register_shutdown_function("anotherfunction('parameter')") ?>
Turns out, the trick is to use create_function() to create a "function" that calls the desired function with static parameters.

<?php
$funtext
="mail('u@ho.com','mail test','sent after shutdown');";
register_shutdown_function(create_function('',$funtext));
?>

Here's another example showing in-line logging and a post-execution version:

Before: in-process logging

<?php
function logit($message) {
  
$oF=fopen('TEST.log', 'a');
  
fwrite($oF,"$message\n");
  
fclose($oF);
  
sleep(5);  // so you can see the delay
}
print
"loging";
logit("traditional execution");
print
"logged";
exit;
?>
After:

<?php
function logit($message) {
  
$forlater=create_function('',"loglater('$message');");
  
register_shutdown_function($forlater);
}
function
loglater($message) {
  
$oF=fopen('TEST.log', 'a');
  
fwrite($oF,"$message\n");
  
fclose($oF);
  
sleep(5);  // so you can see the delay
}
print
"loging";
logit("delayed execution");
print
"logged";
exit;
?>

In the 'before' example, the file is written (and the delay occurs) before the "logged" appears. In the 'after' example, the file is written after execution terminates.

Maybe it would be nice to add a parameter to the register_shutdown_function that does this automatically?
up
3
me at thomaskeller dot biz
11 years ago
Well, it might be obvious, but one should remember that one cannot send any HTTP header in the shutdown callback.

Something like

<?php

function redirect()
{
    
header("Location: myuri.php");
}

register_shutdown_function("redirect");

// do something useful here

?>

doesn't work and PHP sends out the popular "headers already sent" warning.

I tried to set a redirection target somewhere in the script, but wanted to make sure that it was only set/executed at the very end of the script, since my custom redirect function also cleaned any output buffers at that point. Well, no luck here =)
up
8
alexyam at live dot com
5 years ago
When using php-fpm, fastcgi_finish_request() should be used instead of register_shutdown_function() and exit()

For example, under nginx and php-fpm 5.3+, this will make browsers wait 10 seconds to show output:

<?php
   
echo "You have to wait 10 seconds to see this.<br>";
   
register_shutdown_function('shutdown');
    exit;
    function
shutdown(){
       
sleep(10);
        echo
"Because exit() doesn't terminate php-fpm calls immediately.<br>";
    }
?>

This doesn't:

<?php
   
echo "You can see this from the browser immediately.<br>";
   
fastcgi_finish_request();
   
sleep(10);
    echo
"You can't see this form the browser.";
?>
up
4
RLK
9 years ago
Contrary to the the note that "headers are always sent" and some of the comments below - You CAN use header() inside of a shutdown function as you would anywhere else; when headers_sent() is false. You can do custom fatal handling this way:

<?php
ini_set
('display_errors',0);
register_shutdown_function('shutdown');

$obj = new stdClass();
$obj->method();

function
shutdown()
{
  if(!
is_null($e = error_get_last()))
  {
   
header('content-type: text/plain');
    print
"this is not html:\n\n". print_r($e,true);
  }
}
?>
up
1
xcl_rockman at qq dot com
2 years ago
for static call
register_shutdown_function(function () {
                demo::shutdownFunc();
});
up
3
codeslinger at compsalot dot com
12 years ago
Here is a nice little surprise to keep in mind...

If you register a shutdown function for your main program.  And then you fork() a child.

Guess What?
When the child exits it will run the code that was intended for the main program.  This can be a really bad thing  ;-)

Happily there is a simple work-around.  All you need to do is to create a global variable such as:

$IamaChild = [TRUE | FALSE];

and have your shutdown function check the value...
up
1
Niels Ganser <php dot comment at depoll dot de>
12 years ago
Just a quick note: from 5.0.5 on objects will be unloaded _before_ your shutdown function is called which means you can't use previously initiated objects (such as mysqli).

See bug 33772 for more information.
up
3
priebe at mi-corporation dot com
15 years ago
Note that register_shutdown_function() does not work under Apache on Windows platforms.  Your shutdown function will be called, but the connection will not close until the processing is complete.  Zend tells me that this is due to a difference between Apache for *nix and Apache for Windows.

I'm seeing similar behavior under IIS (using php4isapi).
up
2
php at spandex dot deleteme dot nildram dot co dot uk
14 years ago
I've had immense trouble getting any of the examples of emulated destructors to work.  They always seemed to have a copy of the object just after initialisation.  Many people mention that the register_shutdown_function will take a copy of the object rather than a reference... and this can be cured with an ampersand.  If you look in the PEAR docs for the way they emulate destructors you'll find that you also need one before the "new" statement when you create an instance of your object.  There's an editors note above that mentions this too... but I thought I'd collect it all here in one example that really works.  Honest... I'm using it (PHP 4.3.1):

<?php
class Object {
    var
$somevar = "foo";

    function
Object() {
       
$somevar = "bar";
       
register_shutdown_function(array(&$this, 'MyDestructor'));
    }

    function
MyDestructor() {
       
# Do useful destructor stuff here...
   
}
}

# Now create the object as follows and then 'MyDestructor'
# will be called on shutdown and will be able to operate on
# the object as it ended up... not as it started!
$my_object =& new Object;
?>
up
2
astrolox at lawyersonline dot co dot uk
13 years ago
When using the register_shutdown_function command in php 4. The registered functions are called in the order that you register them.

This is important to note if you are doing database work using classes that register shutdown functions for themselves.

You must register the shutdown_functions in the order that you want things to shutdown. ( ie the database needs to shutdown last )

Example of what will not work but what you might expect to work :

<?php
class database {

        function
database() {
                echo
"connect to sql server -- (database :: constructor)<br>\n";
               
register_shutdown_function( array( &$this, "phpshutdown" ) );
               
$this->connected = 1;
        }
       
        function
do_sql( $sql ) {
                if (
$this->connected == 1 ) {
                        echo
"performing sql -- (database :: do_sql)<br>\n";
                } else {
                        echo
" ERROR -- CAN NOT PERFORM SQL -- NOT CONNECTED TO SERVER -- (database :: do_sql)<br>\n";
                }
        }
       
        function
phpshutdown() {
                echo
"close connection to sql server -- <b>(database :: shutdown)</b><br>\n";
               
$this->connected = 0;
        }      
}

class
table {
       
        function
table( &$database, $name ) {
               
$this->database =& $database;
               
$this->name = $name;
                echo
"read table data using database class -- name=$this->name -- (table :: constructor)<br>\n";
               
register_shutdown_function( array( &$this, "phpshutdown" ) );
               
$this->database->do_sql( "read table data" );
        }
       
        function
phpshutdown() {
                echo
"save changes to database -- name=$this->name -- <b>(table :: shutdown)</b><br>\n";
               
$this->database->do_sql( "save table data" );
        }
}

$db =& new database();

$shoppingcard =& new table( &$db, "cart " );
?>

Output of the above example is :-

connect to sql server -- (database :: constructor)
read table data using database class -- name=cart -- (table :: constructor)
performing sql -- (database :: do_sql)
close connection to sql server -- (database :: shutdown)
save changes to database -- name=cart -- (table :: shutdown)
ERROR -- CAN NOT PERFORM SQL -- NOT CONNECTED TO SERVER -- (database :: do_sql)
up
4
sander @ unity-x
7 years ago
simple method to disconnect the client and continue processing:

<?php
function endOutput($endMessage){
   
ignore_user_abort(true);
   
set_time_limit(0);
   
header("Connection: close");
   
header("Content-Length: ".strlen($endMessage));
    echo
$endMessage;
    echo
str_repeat("\r\n", 10); // just to be sure
   
flush();
}

// Must be called before any output
endOutput("thank you for visiting, have a nice day');

sleep(100);
mail("
you@yourmail.com", "ping", "i'm here");
?>
up
1
jawsper at aximax dot nl
7 years ago
Something found out during testing:

the ini auto_append_file will be included BEFORE the registered function(s) will be called.
up
1
michaeln at associationsplus dawt see eh
8 years ago
This may seem obvious to many people, but don't register an object's __destruct() function as a shutdown function! In many instances, it will then call the destructor twice, most likely on an already destroyed object! For example, you might get this error:

PHP Warning:  mysqli::close() [<a href='function.mysqli-close'>function.mysqli-close</a>]: Couldn't fetch mysqli in /path/to/file.php

I saw docey's comment from 2006 in this very page where they do just that, and this more often than not cause problems!

It would be wise to look out for old code where someone has done that very thing then too!
up
1
cFreed at orange dot fr
8 years ago
May be obvious for most people, but I spent time to clearly understand something which is only INDIRECTLY mentioned by the manual, so I hope this useful for someones.

Pay attention to the function prototype: the $function argument is a callback one (follow the link for more information).
This means that you must write this argument differently depending on the $function context:
. function-name, as a string, when it is a built-in or user-defined function
. array(class-name, method-name), when it is an object method
up
1
Fuzika
10 years ago
Sinured's example of how to use a static method did not work for me.
But this did:

<?php
register_shutdown_function
(array('theClass','theStaticMethod'));
?>

Hope this helps someone.

[EDIT by danbrown AT php DOT net: This example did not work for the author of this note because it is written for PHP 5.  The author was using PHP 4.]
up
uphutdown class="keyword">->->->);nt" wof="#85Sr -- Rofunctrlassly. by the manual, srd">nt"_oan b"ect! Forpopula" (phpc the co;
Something fo7260 string, when it is a built-in or user-de260 st130">
->-> 1 s="n31 priebe at mi-co206 Th0 co dot uk
rong>
ir th >opote that tmlancMet oors t/div>
12 years agot"thyou>12 years ago 7.0.15'func5.6.30)>12 years ago12 years ago
(2 yeprivan can>.$db can>."thank you for visit;t">database2 yepublicord">( "rea__;
<, 5 06:02">2 years ago"rea">
Sinurediv class=5 06:02">2 years ago     14 0/div>
$this->"rea">
Sinurediv class=5 06:02">2 years ago2 years ago    &nbslan the order
$this->->);w do/>You mve funcsidebrfuoors t/div> t you register thepan also pss="poors tng>
2 ye class="keyword">->->. -- <b>(table :: shutdown)</b><br>\n"$db nbsp;        nul=.an class="default">$db $db name -- <b>(table :: shutdown)</b><br>\n"register_shutdowword">( class="keyword">->->( class="keyword">->( class="keywor}pan claord">(10com", " ?>
tls;-> 1 priebe at mi-co2020 Th0uctors writte.dgDI,ured'1n class="html/ra;rItdivdo> ¶
¶r more info IS ="phst28 01nnection claittdivdocode>adspan class="htIr />
( class="keywordiv class=5 06:02">2 years ago( class="keyword">->( class="keyword">->2 years ago2 yehttp_&n-pv se_file(5lled 06:02">2 years ago forspan> ?>
->-><61185Thi"tally" id="V85727" title="70% like th6an1/d7v>9: 4
ro"html. Hp
10**ult">1 *nT1 */ord">((2 yepublicoass="da$thisheader;
               
<) 06:02">2 ye5 06:02">2 years ago);wse woru; solu e 06:02">2 years ago"rea$apan class="keyword">;
         dir/span>;
header
register_shutdowword">( class="keyword">->header
;
         v tit, .bsp;
    &nbs - s="default">header
    &nb-- name=( class="keyword">->headerflush(); pan>"rea$apan>();/te if youlogpan class="default">$endMessage;nmixspsp;
  &nendMessage
;FILE_APPENDlt;?php
register_shutdowword">( class="keywor}pan claord">(
);3. byrowcanobucepinformatiopan>"rea">
flush
But tbsp;
    &nb'ault"><?php
register_shutdowtbsp;
    &nb'tyrow<?php
register_shutdowword">(tyrow class="keyword">=& new flush
();'bls bla<?php
register_shutdowword">((
);2. Use>(//">
&wtb'exit'wword">(//exith('exit, bunbsp; &')ord">((>);1. ExithnECTL3">(//">
&wwword">(10(< alsut the tyree >dows wi"keywororu;uncexecu=e. Execu="#40bottom-up yield forspan> ?>
downdeernopcom">dowmonn>doworg-><37915Thi"tally" id="V85727" title="70% like th3-12clas10: 4
astrolox at lawyerson37915Th0uctors writte.dgDI,ured'1n class="html/ra;r/s-pv sespan=0-oted">de 22-Nov- th3s=3:12 i93">br />cod $Value_able dru;unc obvious for able d(span claItpan>Hop2.210flush2 yecod /span>;nValuename=( class="keyworcod /span>;nValue_able drname=(ord">( class="keywor);C
(ord">( class="keywor
header;
               
<)5 06:02">2 years ago);Rdiv> tpcode">2 years ago"rea">
Sinured's ex\n";
                register_shutdown_t">database
2 yed">->header -- <b>(table :: shutdown)</b><br>\n";
         nin_Valuename=( class="keyword">->header -- <b>(table :: shutdown)</b><br>\n";
         nin_Valuename=( class="keyword">->header -- <b>(table :: shutdown)</b><br>\n"<_Loan>();'TEST<?php
register_shutdowword">( class="keywor}pan clpan class="key 06:02">2 yepan>);Dcode">2 ye
2 years ago -- <b>(table :: shutdown)</b><br>\n"<_Loan>();'_TEST<?php
register_shutdowword">( class="keywor}pan clpan class="key 06:02">2 yepan>);Privan core informatio">2 ye
2 years ago;
         fop>   
header();'/tmp/TEST-logid not work for me.
But tbsp;
    &nb'a<?php
register_shutdowword">( class="keyword">->header
  &nendMessage;spp; tfneeds to shutdown la>flush(); %s : %-5sd=u%d ;u%d$endMessage 06:02">2 ye class="keyword">->->But tp;        v tinbsp;   2 ye class="keyword">->->2 ye class="keyword">->-> -- <b>(table :: shutdown)</b><br>\n"2 ye class="keyword">->-> -- <b>(table :: shutdown)</b><br>\n"databaseheader  &nendMessagwword">( class="keywor}pan clpan class="key 06:02">2 yepan>);Fous for able d(srmatio">2 ye
2 years ago -- <b>(table :: shutdown)</b><br>\n"( class="keyword">->header -- <b>(table :: shutdown)</b><br>\n"<_Loan>();'able d<?php
register_shutdowword">( class="keywor}pan claord">(
10(--8" id---=c
1">2 yepan>); years ass="s TESTnmatio">2 ye < years _oan pan>();'ahs_TEST-not<?php
register_shutdowword">( class="keyworord">( class="keywor;  
    &nbsNewp?isdatabase -- name=
2 ye;
&nbsng>2 yeclass="keyword">=& new headerregister_shutdowword">( class="keyworo/span>;
&nbsnspan class="keyword">=& new headerregister_shutdowword">( class="keyworo/span>( class="keyworo/span>;
&nbnspan= class="keyword">=& new headerregister_shutdowword">( class="keyworord">( class="keywor;  
    &nbsS be p?isdatabase -- name=
2 yeheaderregister_shutdowword">( class="keyworord">( class="keywor;  
    &nbsCble dp?isdatabase -- name=
2 ye -- <b>(table :: shutdown)</b><br>\n"( class="keyworo/span> -- <b>(table :: shutdown)</b><br>\n"( class="keyworo/span>dowtclass="string!ord">( class="keywor#no3 shutable d(sword">( class="keyworord">( class="keywornbsp;       &nbsS be p?isdatabase -- name=2 yeheaderregister_shutdowword">( class="keyworord">( class="keywor;  
    &nbsEnd."10(--8" id--------------------------------------------------------------01te>"> forspan> ?>
ted">downder(
astrolox at lawyerson28973Th0uctors writte.dgDI,ured'1n class="html/ra;rO do/y INook its adann tutitle="200class="phpcode"> t908"ument dbr />the d'
;
 class="keyword">=& new
Sinured's ex\n"; ();'sble datid not work for me.
But wn_function
(array(a3">b " hrspan>aoteg>1tepy"ut the ument dyears yo the t893l nr"ths$e.phe ns="ph-28 02:52d'

[EDIT by danbrown AT php DOT 115059This example did not work for the authoc15059Th074"> ?>
tml&n-ultpanc obvious for bd, bu< agoor themseb>bexitspan>1an clas doago
->-> 1 astrolox at lawyersonc15059Th0uctors writte.dgDI,ured'1n class="html/ra;rQuicklook : As"ut ="defa5.11e alwapter thepa/spanunc' do'hst28 mspae sonhthis titlawof="#85use>
[EDIT by danbrown AT php DOT 3763not cause problems!

It would3763not074"> ?>
-><3763not "tally" id="V85727" title="70% like th3-11/d1 12:09
astrolox at lawyerson3763not0 co dot uk
?"keyworInttleticue coagoAasc08"1.3.27 w/s />Hop3.0oagoOS X/aslweasscsoAasc08"1.3.22 w/s />Hop1.2oagoR dnHrnoItpan>< &paova;r mcey'sAasc08"clashemsetce, sthe d'< agountgt;af t908"> ¶r m you regagoI ste that dtexecu="da?"keyworI amhemsesu
http://negs-not.s="/neg-note.ph20447n cl s __destructtdownexi" horid=t,);
as fa /aslIthe tteas, ="phpocuywororugo ¶
8 r0-"mbl, bu; ynch>Hoouslass="html">irths />Hyou>1 ebcse -- envi>Hoywor?"keyworIntmy miunction.ack ose-- e"an cladiv ,l;
i>,athpiahthi20ax"defaulxt"nclass="sl hthe ceff hebmlani" hadibr h dow (php" hadibr h"defaulxban> &)iv clausabimnty"lwa"2r thte tromi, d on objects will be unloaded _before_ yT by danbrown AT php DOT 9189not cause problems!

It would9189not074"> ?>
dowoffyea"Voteownder(
astrolox at lawyerson427s="t0 co dot uk pan>< epopubr /now alwapter thepclass="stringban>908"webpn c class="stce, sthe d'< agault">?> wrin>Guessen> < ag:stce, ');cseemsxchiwriniv clathp8solu thelItp893l nexits pclathp8backgGuesseass="html"hi20axsetallte popula years l hs; years d1006:02">)logger-not --"clashthe time-d'
dowcnty"ed">dk-><6475 Thi"tally" id="V85727" title="70% like th6an4-20 01:07
ru-><7781 Thi"tally" id="V85727" title="70% like th7-09-13v>9:57
lietheen">
asrexa tha:de>
1set_v ti_an clnbsp;     &np;  nenrun class="keyword">;
         fal">     
<){pan cl(">$p;  nstaasnbsp;  
)Nworup14 0globa=.vari; (">ss="default">headerregister_shutdopan>();' id not work for me.
But tp;        nv ti_refname=
( class="keyworo/span>;
         bcadrname=
header  &np;  1       ((">  &np;  nenr     
<){pan cl(">;
         n&n-ultname=
( class="keyword">->header
();'abeck_v tiid not work for me.
But tp;        microv tinbsp;  
    &nb'tru8<?php
register_shutdowwepan>)Fous for "> tmlirthsp14 0ale=te"r loowpan cl(">if(sp;
  &np;  nenr     
<){pan cl(">;
         n&n-ultname=
( class="keyword">->    &nb'sdatab /0register_shutdo.        bcsubname=header  &np;  nstaasnbsp;  
  &np;  1       ();' seuncdsp?isdatab /0register_shutdoword">((">(}t">datan clai/span>abeck_v tinbsp;   )Cal datan cla//Do datan clai/span>$frun class="keyword">;
         fop>   
header();' dows.tatid not work for me.
But tbsp;
    &nb'r<?php
register_shutdowword">(whiha(!sp;
  &np;  feofneeds to shutdown la>flush
$frlt;?php
register_shutdow)5 06:02">2 yean>$bues.;
&nb.sp;        frearname=
headerregister_shutdoebsp;
  &np;  1 24lt;?php
register_shutdowword">(aord">(
ice, n>register_shutdow_t">datan clai/span>10(prd">(As yo t eesma="b>,ri20the ptaas";uncy'sthe enruut the popula,/aslmity dows du93">bdop?itn objects will be unloaded _before_ yT by danbrown AT php DOT 7096not cause problems!

It would7096not074"> ?>