PHP – Execute a Function on Shutdown

The given PHP example helps you to Registers the function named by function to be executed when
the script processing is complete. 

Code Example:
<?php
function say_goodbye() {
		print "Goodbye!\n";
}

register_shutdown_function("say_goodbye");
set_time_limit(2); // Set the number of seconds a script is allowed to run.
print "Sleeping...\n";
sleep(4); // Delays the program execution for the given number of seconds.
print "Done!\n";
?>

Post to Twitter Post to Digg Post to Facebook Post to Google Buzz Send Gmail

Leave a Comment

Your email address will not be published. Required fields are marked *