$fooinstance = new foo();
/*do something*/
exit('bar');
class foo{
__destruct(){
//get the exit message ("bar") to do something with it
}
}
Hello,
I would like to get the exit message to do something with it (for example insert the exit status in a database). Is there a way to do that ?
Thanks
The text
exitsends isn’t special; it’s just text that’s output before the script dies.You could get the text with output buffering, though I’m not sure it’ll be useful:
It would probably be best to wrap the exit instruction in a function that did the appropriate logging.