1

Is there any way I can dump all variables with their values a script has into a file when the script tries to allocate more memory than it is allowed to? For debugging purposes.

php_nub_qq
  • 15,199
  • 21
  • 74
  • 144

1 Answers1

2

You can use this code:

register_shutdown_function('shutdownFunction');
function shutDownFunction() {
    if ($error['type'] == 1) {
        // do your stuff here
    }
} 

It will be called when running into your fatal error.

nl-x
  • 11,762
  • 7
  • 33
  • 61