title: Standard PHP error function with __LINE__ __FILE__etc?
body: <p>so, instead of lots of instances of  </p>
  
  <pre><code>if (odbc_exec($sql))
  {
  }
  else
  {
    myErrorHandlingFunction();
  }
  </code></pre>
  
  <p>I wrap that in a function  </p>
  
  <pre><code>function myOdbxExec($sql)
  {
    if (odbc_exec($sql))
    {
    }
    else
    {
      myErrorHandlingFunction();
    }
  }
  </code></pre>
  
  <p><strong>BUT</strong> I would like <code>myErrorHandlingFunction()</code> to report things like  <code>__LINE__</code> <code>__FILE__</code> etc</p>
  
  <p>Which looks like I have to pass thoses infos to every call of helper functions, e.g. <code>myOdbxExec($sql, __FILE__, __LINE__)</code> which makes my code look messy.</p>
  
  <pre><code>function myErrorHandlingFunction($errorTExt, $fiel, $line)
  {
    // error reporting code goes here
  }
  
  
  function myOdbxExec($sql, $file, $line)
  {
    if (odbc_exec($sql))
    {
    }
    else
    {
      myErrorHandlingFunction();
    }
  }
  
  $sql = 'select * from ... blah, blah, blah...';
  myOdbxExec($sql, __FILE__, __LINE__);   // &lt;==== this is *ugly*
  </code></pre>
  
  <p>In C I would hide it all behind a #define, e.g. <code>#define MY_OFBC_EXEC(sql) myOdbxExec(sql, __FILE__, __LINE__)</code></p>
  
  <p>1) (how) can I do that in PHP
  2) what else is worth outoputting? e.g. <code>error_get_last()</code>? but that has no meaning if odbc_exec() fails ...</p>
  
  <p>To rephrase the question - what's the generic approach to PHP error handling? (especially when <code>set_error_handler()</code> doesn't really apply? </p>
  
  <hr>
  
  <p>Edit: just to be clear - I do want to handle exceptions, programming errors, etc, but, as my example shows, I also want to handle soemthings the teh PHP interpreter might noit consider to be an error, like <code>odbc_exec()</code> returning false().</p>