Say you have a big PHP web application doing echoing, output buffering, etc, all over the place. The end result is a finished HTML/XML document to the browser.
Now say you find yourself in a small function in a random place in a big PHP web application. Is there a simple way to output something, for example an HTML comment, in a way so that it is sent as the last thing to the browser?
Something like a hook for "when everything is finished send this piece of info as well to the browser"?
The end goal is basically to output some warnings or debug info in an easy way, without messing up the output.
There's register_shutdown_function(), which would essentially be the very last thing executed by PHP before terminating your script.