function fail()
{
$backtrace = debug_backtrace();
// Here, $backtrace[0] points to fail(), so we'll look in $backtrace[1] instead
if (isset($backtrace[1]['function']) && $backtrace[1]['function'] == 'epic')
{
// Called by epic()...
}
}
Hope it helps somebody. If the actual function is outside httpdocs then it can not be found because the server will be setup to not allow it. Only tested it one folder deep too but the recursive methodology should work in theory.
This is like version 0.1 but I don't intend on continuing development on it so if someone updates it feel free to repost it.
This will ignore chained functions and get only the most relevant call info (relevant is used loosely as it depends what your are trying to accomplish).