register_shutdown_function() - What is best practice?
<p>I'm currently using register_shutdown_function() for multiple purposes. One use is for handling fatal errors, while the other is for logging resources used during execution like time, memoryusage etc. </p>

<p>Currently I register two different shutdown functions, but on one test only the first ran while the other seemed to fail. Now this could ofcourse be triggered by some error within the function itself so I have rewritten it, but is it possible an error was caused by using several register_shutdown_function calls? So what is considered best practice here, to registert two different functions or just make the call to one function that handles the different tasks?</p>

<p>Is it also safe (and possible) to make the function load a class for errorhandling if a fatal error occurs or should I keep the functionality within the function itself?</p>

<p>The final question I got is if there's a better way to handle fatal errors than using shutdown functions? I tried using set_error_handler, but it does not cover all errortypes so some errors will not trigger this.</p>

<p>Hope these questions are well formulated and clear. My goal is to keep the code as solid as possible and I could not find any decent answers to the questions I had.</p>

<p>*Edit: Found the answer to my first question, registering several functions should be no problem so the error had to be within the function itself. Leaving the question up to get answers to whether there's a better ways to handle fatal errors.</p>
