Using register_shutdown_function() instead of desctructor in PHP
February 18, 2020 — The usual and might be the most used way of cleaning the object is to use the good old __destruct() magic method in PHP. The magic method proves to be good in most of the cases. But there might be some scenario where even the __destruct()
method will fail. For instance, a scenario where your PHP script exceeds the maximum execution time, and terminates thusly. And a fatal error would occur called Maximum execution time of 20 seconds exceeded in - on line XX
.