Determine the "offending" file and line number when error occurs
<p>This is a bit hard to explain but the code might be clearer:</p>

<pre><code>// class.php
class Foo
{
    public function bar ()
    {

    }
}


// test.php
$foo = new Foo;
$foo-&gt;bar(); // e.g., for some reason this returns an error hence error handler will be triggered
</code></pre>

<p>This is a simplified example but the nesting of test.php could be deeper.
How can my custom error handler tell me that the error occurred in test.php line 2?</p>

<p>I am currently using <code>debug_backtrace()</code> but the array index of test.php is varying depending on how deep the object is or how many <code>require()</code>'s</p>

<p>Is there a way to pinpoint this regardless of how deep the nesting of the function call is?</p>
