note 98200 deleted from function.register-shutdown-function by crell
| From: | crell@php.net | Date: | Wed, 30 Mar 2022 22:08:50 +0000 |
| Subject: | note 98200 deleted from function.register-shutdown-function by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-217813@lists.php.net to get a copy of this message | ||
Note Submitter: clover at fromru dot com
----
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