In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] ("Greig, Euan") wrote: > I was hoping that I could use this function to enable me to finish scripts > tidily when they time out or are aborted by the user. eg display the message > "script timed out". However this will not work as no output is allowed in the > shutdown function. I can see other ways to do what I want (but suggestions > would always be welcome) but the real point of this email is this: what sort > of thing would you use register_shutdown_function to achieve? Not a fancy example, but... I use it in a script which loops through a database of urls to validate them. With each loop, set_time_limit gets reset for a length of time more than sufficient for processing a valid url. If an iteration takes too long, the script will timeout and die without an error message. Since in this case timeout == bad url, register_shutdown_function() allows me to send a final query back to the database marking the current url as invalid. Otherwise, when I start the script up again it would always have that same url sitting at the top of the processing list where it would just timeout over and over again (which is what it used to do--what a PITA). You could also use register_shutdown_function() to, for instance, email yourself information about why a script terminated and what state it was left in. Output to the *browser is disallowed, but output to other destinations (logs, email, filesystem, databases, etc.) still works. You can take advantage of that. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]

