title: PHP get warning and error messages?
body: <p>I want to get warning and error messages into php $variables so I save them to my database.</p>
  
  <p>For example when there is any kind of error, warning or similar:</p>
  
  <pre><code>Parse error: syntax error, unexpected T_VARIABLE in /example.php(136) on line 9
  Warning: [...]
  </code></pre>
  
  <p>I want to get them to variable $error_code</p>
  
  <p>How is this done?</p>