title: Show PHP errors as a string for display
body: <p>I'm trying to find out how I would put a PHP error into a variable to display.</p>
  
  <p>Similar to the <code>mysql_error();</code> I'd like to be able to have displayed the error that PHP gives?</p>
  
  <p>I'm using <code>json_encode</code> to send the testing user back a value from the requested PHP page but if an error happens I can get the <code>mysql_error();</code> fine but how would I get the php error?</p>
  
  <p>I've tryed <code>$phpError = error_reporting();</code> but I just get error <code>22527</code> like this <a href="https://stackoverflow.com/questions/4678082/what-is-22527-in-error-reporting-22527-of-phpinfo">same Error</a>. I just want to put the php error into a string to send back to the user.</p>