im trying to understand php constructor and destructor behaviour. Everything goes as expected with the constructor but i am having trouble getting the destructor to fire imp
Method __destruct() is usless. Is better to do something like this:
class MyClass {
function __construct() {
register_shutdown_function([
&$this,
'the_end_game'
]);
}
function the_end_game() {
/* Your last part of code, save logs or what you want */
}
}