|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2008-08-17 17:33 UTC] faw217 at gmail dot com
 Description: ------------ Hi, I was just wondering, how to make a destructor in a class not run in some sort of situations (especially: after calling die() function) and then I realised that it's impossible. But actually why? Of course I can call a function manually but I think destructors were created so that I can use them at the end of script execution time. That's why I don't see a reason, why I shouldn't use them. Of course I can use also register_shutdown_function(); but then I can't change the output, since it is executed after ending with sending request to webbrowser. I think this feature (or change, call it as you want) will be sth, what will make die() function different from exit language construct. Consider this, please. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 13:00:01 2025 UTC | 
changing the behavior would break everybody relying on the current one. And it's not worth to introduce such a specific feature to the core, you can easily do something like function my_own_die() { $GLOBALS['in_shutdown'] = true; } and then check that value in destructors... for more info check other support facilities like the generals list, see php.net/support.php