title: how to read a php error message into a string variable
body: <p>I'm doing a small program which needs to read error meesage when errors occur.</p>
  
  <p>For example, one operation triggered an error, and php log recorded it as:</p>
  
  <pre><code>PHP Fatal error:  Smarty error: [in /mnt/n2my_web/templates/ja_JP/mail/reservation_create.t.txt line 16]: syntax error: mismatched tag {/if}. (Smarty_Compiler.class.php, line 2338) in /mnt/n2my_web/lib/Smarty/Smarty.class.php on line 1092
  </code></pre>
  
  <p>I know by setting <strong>ini_set('display_errors', '1');</strong> the error message can be printed. But I need to read it, in order to format it.</p>
  
  <p>By which means can I achieve this? Any answer is appreciated. :)</p>