title: Does register_shutdown_function() get called before or after the response is echoed?
body: <p>I am writing a Phalcon PHP application. In it, I register a shutdown function in the constructor of a class:</p>
  
  <pre><code>public function __construct()
  {
      register_shutdown_function([$this, 'shutdownHandler']);
  }
  
  public function shutdownHandler()
  {
      $this-&gt;deliverQueue();
  }
  </code></pre>
  
  <p>Whenever the conditions for it to run hold, the waiting time for the response is higher. </p>
  
  <p>I made a small test: When I comment out the <code>deliverQueue</code>, response comes back in one second. When I replace this line with a sleep(1), response comes back after 5-6(!!!) seconds. When I replace with a sleep(10), 500 error.</p>
  
  <p>Per the documentation, I would expect the shutdown function to activate <strong>after</strong> script execution finishes, therefore <strong>after</strong> the response gets echoed back.</p>
  
  <p>Is the documentation incorrect? Why is this happening?</p>