register_shutdown_function

register_shutdown_function

register_shutdown_function
- used to register functions which will be called after script reaches end.
- we can register multiple functions using register_shutdown_function

Arguments:
- func (which takes function name)

Example:
function myFunction(){
echo “My Fucntion”;
}
register_shutdown_function(myFunction);

echo “My Script”;

Usage:
Basically, it is used for clean up purpose.
For example, to close the file handles, close database connections,close sessions and etc.

Note : don’t give exit() in any registered function. if you give exit in a function, other register functions won’t be called.

Leave a Reply

You must be logged in to post a comment.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.