Interesting behavior of __construct() and __destruct() in PHP
<p>I was testing a class whilst developing my app and just like any other quick-lazy-method-tweak I did an <code>echo</code> in </p>

<pre><code>function __construct(){
   parent::__construct();
   echo "yaba daba doo"; 
   exit();
}
</code></pre>

<p>Now, after few tests and all, I thought of checking if the class has been fully compiled thus I wrote:</p>

<pre><code>function __destruct(){
   echo "ends here"; 
   exit();
}
</code></pre>

<p>Interestingly, even though there was an <code>exit</code> in <code>__construct</code> , it still executed <code>__destruct</code>!</p>

<p>As per my knowledge exit 'kills' the process, doesn't it?</p>

<p><code>__destruct</code> is called upon when the object has no more reference for the class.</p>

<p>Does that mean, <code>exit(0)</code> does not kill the process on priority?</p>

<p>Is it a PHP bug? because, IMO the script shouldn't go any further?</p>
