I was testing a class whilst developing my app and just like any other quick-lazy-method-tweak I did an echo in
function __construct(){
parent::__construct();
echo "yaba daba doo";
exit();
}
Now, after few tests and all, I thought of checking if the class has been fully compiled thus I wrote:
function __destruct(){
echo "ends here";
exit();
}
Interestingly, even though there was an exit in __construct , it still executed __destruct!
As per my knowledge exit ‘kills’ the process, doesn’t it?
__destruct is called upon when the object has no more reference for the class.
Does that mean, exit(0) does not kill the process on priority?
Is it a PHP bug? because, IMO the script shouldn’t go any further?
It’s all in the manual.