title: PHP error handler and ErrorException confusion: log stack trace
body: <p>I want to log all PHP errors to a database, all with a stack trace. But the <a href="http://us3.php.net/manual/en/class.errorexception.php" rel="nofollow">PHP Manual</a> snippet has me confused:</p>
  
  <pre><code>function exception_error_handler($errno, $errstr, $errfile, $errline ) {
      throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
  }
  set_error_handler("exception_error_handler");
  </code></pre>
  
  <p>I currently use the function that I pass to `set_error_handler()' to log the error to the database. But if I use the above code, <strong>where do I put the code that writes the error and stack trace to the database?</strong></p>
  
  <pre><code>function error_handler($errno, $errstr, $errfile, $errline){
      $err = array(
          'errno' =&gt; $errno,
          'errstr' =&gt; $errstr,
          'errfile' =&gt; $errfile,
          'errline' =&gt; $errline
      );
      DB::insertAssoc('table_error', $err);
  }
  </code></pre>